xgo/compiler/ast/func_lit.go

26 lines
561 B
Go
Raw Normal View History

2019-01-09 10:17:42 +03:00
package ast
2019-01-11 13:27:28 +03:00
import "github.com/d5/tengo/compiler/source"
2019-01-09 10:17:42 +03:00
// FuncLit represents a function literal.
2019-01-09 10:17:42 +03:00
type FuncLit struct {
Type *FuncType
Body *BlockStmt
}
func (e *FuncLit) exprNode() {}
// Pos returns the position of first character belonging to the node.
func (e *FuncLit) Pos() source.Pos {
2019-01-09 10:17:42 +03:00
return e.Type.Pos()
}
// End returns the position of first character immediately after the node.
func (e *FuncLit) End() source.Pos {
2019-01-09 10:17:42 +03:00
return e.Body.End()
}
func (e *FuncLit) String() string {
return "func" + e.Type.Params.String() + " " + e.Body.String()
}