MCPcopy Create free account
hub / github.com/araddon/qlbridge / inlineIncludesDepth

Function inlineIncludesDepth

expr/include.go:37–63  ·  view source on GitHub ↗
(ctx Includer, arg Node, depth int)

Source from the content-addressed store, hash-verified

35 return inlineIncludesDepth(ctx, newNode, depth)
36}
37func 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
65func resolveInclude(ctx Includer, inc *IncludeNode, depth int) (Node, error) {
66

Callers 1

doInlineIncludesFunction · 0.85

Calls 2

resolveIncludeFunction · 0.70
ChildrenArgsMethod · 0.65

Tested by

no test coverage detected