diff options
Diffstat (limited to 'vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/diagnostics.go')
-rw-r--r-- | vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/diagnostics.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/diagnostics.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/diagnostics.go new file mode 100644 index 0000000..94eaf58 --- /dev/null +++ b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/diagnostics.go | |||
@@ -0,0 +1,23 @@ | |||
1 | package hclsyntax | ||
2 | |||
3 | import ( | ||
4 | "github.com/hashicorp/hcl2/hcl" | ||
5 | ) | ||
6 | |||
7 | // setDiagEvalContext is an internal helper that will impose a particular | ||
8 | // EvalContext on a set of diagnostics in-place, for any diagnostic that | ||
9 | // does not already have an EvalContext set. | ||
10 | // | ||
11 | // We generally expect diagnostics to be immutable, but this is safe to use | ||
12 | // on any Diagnostics where none of the contained Diagnostic objects have yet | ||
13 | // been seen by a caller. Its purpose is to apply additional context to a | ||
14 | // set of diagnostics produced by a "deeper" component as the stack unwinds | ||
15 | // during expression evaluation. | ||
16 | func setDiagEvalContext(diags hcl.Diagnostics, expr hcl.Expression, ctx *hcl.EvalContext) { | ||
17 | for _, diag := range diags { | ||
18 | if diag.Expression == nil { | ||
19 | diag.Expression = expr | ||
20 | diag.EvalContext = ctx | ||
21 | } | ||
22 | } | ||
23 | } | ||