TraverseRel applies the receiving traversal to the given value, returning the resulting value. This is supported only for relative traversals, and will panic if applied to an absolute traversal.
(val cty.Value)
| 42 | // the resulting value. This is supported only for relative traversals, |
| 43 | // and will panic if applied to an absolute traversal. |
| 44 | func (t Traversal) TraverseRel(val cty.Value) (cty.Value, Diagnostics) { |
| 45 | if !t.IsRelative() { |
| 46 | panic("can't use TraverseRel on an absolute traversal") |
| 47 | } |
| 48 | |
| 49 | current := val |
| 50 | var diags Diagnostics |
| 51 | for _, tr := range t { |
| 52 | var newDiags Diagnostics |
| 53 | current, newDiags = tr.TraversalStep(current) |
| 54 | diags = append(diags, newDiags...) |
| 55 | if newDiags.HasErrors() { |
| 56 | return cty.DynamicVal, diags |
| 57 | } |
| 58 | } |
| 59 | return current, diags |
| 60 | } |
| 61 | |
| 62 | // TraverseAbs applies the receiving traversal to the given eval context, |
| 63 | // returning the resulting value. This is supported only for absolute |
no test coverage detected