zclsyntax: RelativeTraversalExpr
This is similar to ScopeTraversalExpr, but it traverses relative to the result of another expression rather than relative to a variable in the scope.
This commit is contained in:
parent
6f2bd0009c
commit
0d0404867c
@ -70,6 +70,30 @@ func (e *ScopeTraversalExpr) StartRange() zcl.Range {
|
|||||||
return e.SrcRange
|
return e.SrcRange
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RelativeTraversalExpr is an Expression that retrieves a value from another
|
||||||
|
// value using a _relative_ traversal.
|
||||||
|
type RelativeTraversalExpr struct {
|
||||||
|
Source Expression
|
||||||
|
Traversal zcl.Traversal
|
||||||
|
SrcRange zcl.Range
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *RelativeTraversalExpr) walkChildNodes(w internalWalkFunc) {
|
||||||
|
// Scope traversals have no child nodes
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *RelativeTraversalExpr) Value(ctx *zcl.EvalContext) (cty.Value, zcl.Diagnostics) {
|
||||||
|
panic("RelativeTraversalExpr.Value not yet implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *RelativeTraversalExpr) Range() zcl.Range {
|
||||||
|
return e.SrcRange
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *RelativeTraversalExpr) StartRange() zcl.Range {
|
||||||
|
return e.SrcRange
|
||||||
|
}
|
||||||
|
|
||||||
// FunctionCallExpr is an Expression that calls a function from the EvalContext
|
// FunctionCallExpr is an Expression that calls a function from the EvalContext
|
||||||
// and returns its result.
|
// and returns its result.
|
||||||
type FunctionCallExpr struct {
|
type FunctionCallExpr struct {
|
||||||
|
@ -27,6 +27,10 @@ func (e *ObjectConsExpr) Variables() []zcl.Traversal {
|
|||||||
return Variables(e)
|
return Variables(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (e *RelativeTraversalExpr) Variables() []zcl.Traversal {
|
||||||
|
return Variables(e)
|
||||||
|
}
|
||||||
|
|
||||||
func (e *ScopeTraversalExpr) Variables() []zcl.Traversal {
|
func (e *ScopeTraversalExpr) Variables() []zcl.Traversal {
|
||||||
return Variables(e)
|
return Variables(e)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user