(ctx Includer, inc *IncludeNode, depth int)
| 63 | } |
| 64 | |
| 65 | func 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 | |
| 95 | func findAllIncludes(node Node, current []string) []string { |
| 96 | switch n := node.(type) { |
no test coverage detected