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

Function resolveInclude

expr/include.go:65–93  ·  view source on GitHub ↗
(ctx Includer, inc *IncludeNode, depth int)

Source from the content-addressed store, hash-verified

63}
64
65func resolveInclude(ctx Includer, inc *IncludeNode, depth int) (Node, error) {
66
67 // if inc.inlineExpr != nil {
68 // return inc.inlineExpr, nil
69 // }
70
71 n, err := ctx.Include(inc.Identity.Text)
72 if err != nil {
73 return nil, err
74 }
75 if n == nil {
76 return nil, ErrIncludeNotFound
77 }
78
79 // Now inline, the inlines
80 n, err = doInlineIncludes(ctx, n, depth)
81 if err != nil {
82 return nil, err
83 }
84 if inc.Negated() {
85 inc.inlineExpr = NewUnary(lex.Token{T: lex.TokenNegate, V: "NOT"}, n)
86 } else {
87 inc.inlineExpr = n
88 }
89
90 inc.ExprNode = inc.inlineExpr
91
92 return inc.inlineExpr, nil
93}
94
95func findAllIncludes(node Node, current []string) []string {
96 switch n := node.(type) {

Callers 1

inlineIncludesDepthFunction · 0.70

Calls 4

doInlineIncludesFunction · 0.85
NewUnaryFunction · 0.85
IncludeMethod · 0.65
NegatedMethod · 0.65

Tested by

no test coverage detected