zclsyntax: stub of FunctionCallExpr

This was added mainly just to spin the wheels of the Variables method
generator. Its implementation is not yet complete.
This commit is contained in:
Martin Atkins 2017-05-24 08:51:34 -07:00
parent bae8f83298
commit 31caa36b9a
2 changed files with 33 additions and 0 deletions

View File

@ -65,3 +65,32 @@ func (e *ScopeTraversalExpr) Range() zcl.Range {
func (e *ScopeTraversalExpr) StartRange() zcl.Range {
return e.SrcRange
}
// FunctionCallExpr is an Expression that calls a function from the EvalContext
// and returns its result.
type FunctionCallExpr struct {
Name string
Args []Expression
NameRange zcl.Range
OpenParenRange zcl.Range
CloseParenRange zcl.Range
}
func (e *FunctionCallExpr) walkChildNodes(w internalWalkFunc) {
for i, arg := range e.Args {
e.Args[i] = w(arg).(Expression)
}
}
func (e *FunctionCallExpr) Value(ctx *zcl.EvalContext) (cty.Value, zcl.Diagnostics) {
panic("FunctionCallExpr.Value not yet implemented")
}
func (e *FunctionCallExpr) Range() zcl.Range {
return zcl.RangeBetween(e.NameRange, e.CloseParenRange)
}
func (e *FunctionCallExpr) StartRange() zcl.Range {
return zcl.RangeBetween(e.NameRange, e.OpenParenRange)
}

View File

@ -7,6 +7,10 @@ import (
"github.com/apparentlymart/go-zcl/zcl"
)
func (e *FunctionCallExpr) Variables() []zcl.Traversal {
return Variables(e)
}
func (e *LiteralValueExpr) Variables() []zcl.Traversal {
return Variables(e)
}