setDiagEvalContext is an internal helper that will impose a particular EvalContext on a set of diagnostics in-place, for any diagnostic that does not already have an EvalContext set. We generally expect diagnostics to be immutable, but this is safe to use on any Diagnostics where none of the contai
(diags hcl.Diagnostics, expr hcl.Expression, ctx *hcl.EvalContext)
| 17 | // set of diagnostics produced by a "deeper" component as the stack unwinds |
| 18 | // during expression evaluation. |
| 19 | func setDiagEvalContext(diags hcl.Diagnostics, expr hcl.Expression, ctx *hcl.EvalContext) { |
| 20 | for _, diag := range diags { |
| 21 | if diag.Expression == nil { |
| 22 | diag.Expression = expr |
| 23 | diag.EvalContext = ctx |
| 24 | } |
| 25 | } |
| 26 | } |