]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / hcl2 / hcl / hclsyntax / expression_template.go
index a1c472754d2858e0a7a98a8172f486a1d83201bb..fa79e3d08f7d83741a7a481a6b1b64a7be1bc2f6 100644 (file)
@@ -16,8 +16,8 @@ type TemplateExpr struct {
 }
 
 func (e *TemplateExpr) walkChildNodes(w internalWalkFunc) {
-       for i, part := range e.Parts {
-               e.Parts[i] = w(part).(Expression)
+       for _, part := range e.Parts {
+               w(part)
        }
 }
 
@@ -37,8 +37,10 @@ func (e *TemplateExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics)
                                Detail: fmt.Sprintf(
                                        "The expression result is null. Cannot include a null value in a string template.",
                                ),
-                               Subject: part.Range().Ptr(),
-                               Context: &e.SrcRange,
+                               Subject:     part.Range().Ptr(),
+                               Context:     &e.SrcRange,
+                               Expression:  part,
+                               EvalContext: ctx,
                        })
                        continue
                }
@@ -61,8 +63,10 @@ func (e *TemplateExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics)
                                        "Cannot include the given value in a string template: %s.",
                                        err.Error(),
                                ),
-                               Subject: part.Range().Ptr(),
-                               Context: &e.SrcRange,
+                               Subject:     part.Range().Ptr(),
+                               Context:     &e.SrcRange,
+                               Expression:  part,
+                               EvalContext: ctx,
                        })
                        continue
                }
@@ -94,7 +98,7 @@ type TemplateJoinExpr struct {
 }
 
 func (e *TemplateJoinExpr) walkChildNodes(w internalWalkFunc) {
-       e.Tuple = w(e.Tuple).(Expression)
+       w(e.Tuple)
 }
 
 func (e *TemplateJoinExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) {
@@ -127,7 +131,9 @@ func (e *TemplateJoinExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti
                                Detail: fmt.Sprintf(
                                        "An iteration result is null. Cannot include a null value in a string template.",
                                ),
-                               Subject: e.Range().Ptr(),
+                               Subject:     e.Range().Ptr(),
+                               Expression:  e,
+                               EvalContext: ctx,
                        })
                        continue
                }
@@ -143,7 +149,9 @@ func (e *TemplateJoinExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti
                                        "Cannot include one of the interpolation results into the string template: %s.",
                                        err.Error(),
                                ),
-                               Subject: e.Range().Ptr(),
+                               Subject:     e.Range().Ptr(),
+                               Expression:  e,
+                               EvalContext: ctx,
                        })
                        continue
                }
@@ -176,7 +184,7 @@ type TemplateWrapExpr struct {
 }
 
 func (e *TemplateWrapExpr) walkChildNodes(w internalWalkFunc) {
-       e.Wrapped = w(e.Wrapped).(Expression)
+       w(e.Wrapped)
 }
 
 func (e *TemplateWrapExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) {