Range and StartRange methods on Expression
This gives us some contextual information to use for error handling when working generically with expressions.
This commit is contained in:
parent
802ea19d72
commit
bb5044d015
@ -259,3 +259,11 @@ func (e *expression) Value(ctx *zcl.EvalContext) (cty.Value, zcl.Diagnostics) {
|
|||||||
return cty.DynamicVal, nil
|
return cty.DynamicVal, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (e *expression) Range() zcl.Range {
|
||||||
|
return e.src.Range()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *expression) StartRange() zcl.Range {
|
||||||
|
return e.src.StartRange()
|
||||||
|
}
|
||||||
|
@ -101,6 +101,9 @@ type Expression interface {
|
|||||||
// the specific symbol in question.
|
// the specific symbol in question.
|
||||||
Value(ctx *EvalContext) (cty.Value, Diagnostics)
|
Value(ctx *EvalContext) (cty.Value, Diagnostics)
|
||||||
|
|
||||||
|
Range() Range
|
||||||
|
StartRange() Range
|
||||||
|
|
||||||
// TODO: A "Variables" method that returns a description of all of the
|
// TODO: A "Variables" method that returns a description of all of the
|
||||||
// variables used in the expression, so callers can populate the scope
|
// variables used in the expression, so callers can populate the scope
|
||||||
// only with variables that are actually used.
|
// only with variables that are actually used.
|
||||||
|
Loading…
Reference in New Issue
Block a user