diff options
Diffstat (limited to 'vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template.go')
-rw-r--r-- | vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template.go | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template.go index a1c4727..fa79e3d 100644 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template.go +++ b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template.go | |||
@@ -16,8 +16,8 @@ type TemplateExpr struct { | |||
16 | } | 16 | } |
17 | 17 | ||
18 | func (e *TemplateExpr) walkChildNodes(w internalWalkFunc) { | 18 | func (e *TemplateExpr) walkChildNodes(w internalWalkFunc) { |
19 | for i, part := range e.Parts { | 19 | for _, part := range e.Parts { |
20 | e.Parts[i] = w(part).(Expression) | 20 | w(part) |
21 | } | 21 | } |
22 | } | 22 | } |
23 | 23 | ||
@@ -37,8 +37,10 @@ func (e *TemplateExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) | |||
37 | Detail: fmt.Sprintf( | 37 | Detail: fmt.Sprintf( |
38 | "The expression result is null. Cannot include a null value in a string template.", | 38 | "The expression result is null. Cannot include a null value in a string template.", |
39 | ), | 39 | ), |
40 | Subject: part.Range().Ptr(), | 40 | Subject: part.Range().Ptr(), |
41 | Context: &e.SrcRange, | 41 | Context: &e.SrcRange, |
42 | Expression: part, | ||
43 | EvalContext: ctx, | ||
42 | }) | 44 | }) |
43 | continue | 45 | continue |
44 | } | 46 | } |
@@ -61,8 +63,10 @@ func (e *TemplateExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) | |||
61 | "Cannot include the given value in a string template: %s.", | 63 | "Cannot include the given value in a string template: %s.", |
62 | err.Error(), | 64 | err.Error(), |
63 | ), | 65 | ), |
64 | Subject: part.Range().Ptr(), | 66 | Subject: part.Range().Ptr(), |
65 | Context: &e.SrcRange, | 67 | Context: &e.SrcRange, |
68 | Expression: part, | ||
69 | EvalContext: ctx, | ||
66 | }) | 70 | }) |
67 | continue | 71 | continue |
68 | } | 72 | } |
@@ -94,7 +98,7 @@ type TemplateJoinExpr struct { | |||
94 | } | 98 | } |
95 | 99 | ||
96 | func (e *TemplateJoinExpr) walkChildNodes(w internalWalkFunc) { | 100 | func (e *TemplateJoinExpr) walkChildNodes(w internalWalkFunc) { |
97 | e.Tuple = w(e.Tuple).(Expression) | 101 | w(e.Tuple) |
98 | } | 102 | } |
99 | 103 | ||
100 | func (e *TemplateJoinExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { | 104 | 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 | |||
127 | Detail: fmt.Sprintf( | 131 | Detail: fmt.Sprintf( |
128 | "An iteration result is null. Cannot include a null value in a string template.", | 132 | "An iteration result is null. Cannot include a null value in a string template.", |
129 | ), | 133 | ), |
130 | Subject: e.Range().Ptr(), | 134 | Subject: e.Range().Ptr(), |
135 | Expression: e, | ||
136 | EvalContext: ctx, | ||
131 | }) | 137 | }) |
132 | continue | 138 | continue |
133 | } | 139 | } |
@@ -143,7 +149,9 @@ func (e *TemplateJoinExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti | |||
143 | "Cannot include one of the interpolation results into the string template: %s.", | 149 | "Cannot include one of the interpolation results into the string template: %s.", |
144 | err.Error(), | 150 | err.Error(), |
145 | ), | 151 | ), |
146 | Subject: e.Range().Ptr(), | 152 | Subject: e.Range().Ptr(), |
153 | Expression: e, | ||
154 | EvalContext: ctx, | ||
147 | }) | 155 | }) |
148 | continue | 156 | continue |
149 | } | 157 | } |
@@ -176,7 +184,7 @@ type TemplateWrapExpr struct { | |||
176 | } | 184 | } |
177 | 185 | ||
178 | func (e *TemplateWrapExpr) walkChildNodes(w internalWalkFunc) { | 186 | func (e *TemplateWrapExpr) walkChildNodes(w internalWalkFunc) { |
179 | e.Wrapped = w(e.Wrapped).(Expression) | 187 | w(e.Wrapped) |
180 | } | 188 | } |
181 | 189 | ||
182 | func (e *TemplateWrapExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { | 190 | func (e *TemplateWrapExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { |