]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blob - vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/diagnostics.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / hcl2 / hcl / hclsyntax / diagnostics.go
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 }