MCPcopy Create free account
hub / github.com/abiosoft/mold / processTree

Function processTree

process.go:10–20  ·  view source on GitHub ↗

processTree traverses the node tree and swaps render and partial declarations with equivalent template calls. It returns all referenced templates encountered during the traversal.

(t *templateFile)

Source from the content-addressed store, hash-verified

8// processTree traverses the node tree and swaps render and partial declarations with equivalent template calls.
9// It returns all referenced templates encountered during the traversal.
10func processTree(t *templateFile) ([]nestedFile, error) {
11 ts, err := processNode(t, nil, 0, t.Tree.Root)
12 if err != nil {
13 if err, ok := err.(posErr); ok {
14 line, col := pos(t.body, err.pos)
15 return ts, fmt.Errorf("%s:%d:%d: %s: %w", t.Name(), line, col, t.typ, err)
16 }
17 }
18
19 return ts, nil
20}
21
22func processNode(root *templateFile, parent *parse.ListNode, index int, node parse.Node) (ts []nestedFile, err error) {
23 // appendResult appends the specified templates to the list of template names when there are no errors

Callers 3

parseLayoutFunction · 0.85
parseViewFunction · 0.85
parsePartialFunction · 0.85

Calls 2

processNodeFunction · 0.85
posFunction · 0.85

Tested by

no test coverage detected