xgo/ast/for_in_stmt.go
2019-01-08 23:17:42 -08:00

29 lines
595 B
Go

package ast
import "github.com/d5/tengo/scanner"
type ForInStmt struct {
ForPos scanner.Pos
Key *Ident
Value *Ident
Iterable Expr
Body *BlockStmt
}
func (s *ForInStmt) stmtNode() {}
func (s *ForInStmt) Pos() scanner.Pos {
return s.ForPos
}
func (s *ForInStmt) End() scanner.Pos {
return s.Body.End()
}
func (s *ForInStmt) String() string {
if s.Value != nil {
return "for " + s.Key.String() + ", " + s.Value.String() + " in " + s.Iterable.String() + " " + s.Body.String()
}
return "for " + s.Key.String() + " in " + s.Iterable.String() + " " + s.Body.String()
}