2019-01-09 10:17:42 +03:00
|
|
|
package ast
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
2019-01-11 12:16:34 +03:00
|
|
|
"github.com/d5/tengo/source"
|
2019-01-09 10:17:42 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
type CallExpr struct {
|
|
|
|
Func Expr
|
2019-01-11 12:16:34 +03:00
|
|
|
LParen source.Pos
|
2019-01-09 10:17:42 +03:00
|
|
|
Args []Expr
|
2019-01-11 12:16:34 +03:00
|
|
|
RParen source.Pos
|
2019-01-09 10:17:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *CallExpr) exprNode() {}
|
|
|
|
|
2019-01-11 12:16:34 +03:00
|
|
|
func (e *CallExpr) Pos() source.Pos {
|
2019-01-09 10:17:42 +03:00
|
|
|
return e.Func.Pos()
|
|
|
|
}
|
|
|
|
|
2019-01-11 12:16:34 +03:00
|
|
|
func (e *CallExpr) End() source.Pos {
|
2019-01-09 10:17:42 +03:00
|
|
|
return e.RParen + 1
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *CallExpr) String() string {
|
|
|
|
var args []string
|
|
|
|
for _, e := range e.Args {
|
|
|
|
args = append(args, e.String())
|
|
|
|
}
|
|
|
|
|
|
|
|
return e.Func.String() + "(" + strings.Join(args, ", ") + ")"
|
|
|
|
}
|