(ctx Includer, arg Node, depth int)
| 35 | return inlineIncludesDepth(ctx, newNode, depth) |
| 36 | } |
| 37 | func inlineIncludesDepth(ctx Includer, arg Node, depth int) (Node, error) { |
| 38 | if depth > maxIncludeDepth { |
| 39 | return nil, ErrMaxDepth |
| 40 | } |
| 41 | |
| 42 | switch n := arg.(type) { |
| 43 | // FuncNode, BinaryNode, BooleanNode, TriNode, UnaryNode, ArrayNode |
| 44 | case NodeArgs: |
| 45 | args := n.ChildrenArgs() |
| 46 | for i, narg := range args { |
| 47 | newNode, err := inlineIncludesDepth(ctx, narg, depth+1) |
| 48 | if err != nil { |
| 49 | return nil, err |
| 50 | } |
| 51 | if newNode != nil { |
| 52 | args[i] = newNode |
| 53 | } |
| 54 | } |
| 55 | return arg, nil |
| 56 | case *IncludeNode: |
| 57 | return resolveInclude(ctx, n, depth+1) |
| 58 | default: |
| 59 | //*NumberNode, *IdentityNode, *StringNode, nil, |
| 60 | //*ValueNode, *NullNode: |
| 61 | return arg, nil |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | func resolveInclude(ctx Includer, inc *IncludeNode, depth int) (Node, error) { |
| 66 |
no test coverage detected