MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / visit

Function visit

src/tools/ast/syntax-check.ts:68–87  ·  view source on GitHub ↗
(node: TSNodeLike)

Source from the content-addressed store, hash-verified

66 const lines = content.split('\n');
67 const issues: SyntaxIssue[] = [];
68 const visit = (node: TSNodeLike): void => {
69 if (issues.length >= MAX_REPORTED_ISSUES) return;
70 // Prune: only descend where an error lives (real tree-sitter sets hasError
71 // on every ancestor of an ERROR/MISSING node). Mocks may omit it → descend.
72 if (node.hasError !== undefined && !boolProp(node.hasError, node)) return;
73 const missing = boolProp(node.isMissing, node);
74 if (node.type === 'ERROR' || missing) {
75 const line = node.startPosition.row + 1;
76 issues.push({
77 line,
78 excerpt: (lines[node.startPosition.row] ?? '').trim().slice(0, 120),
79 kind: missing ? 'missing' : 'error',
80 });
81 if (node.type === 'ERROR') return; // children of an ERROR node are noise
82 }
83 for (let i = 0; i < node.childCount; i++) {
84 const c = node.child(i);
85 if (c) visit(c);
86 }
87 };
88 visit(root);
89 return issues;
90}

Callers 1

findIssuesInTreeFunction · 0.70

Calls 3

boolPropFunction · 0.85
childMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected