MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / walkProgram

Method walkProgram

src/extraction/cfml-extractor.ts:147–166  ·  view source on GitHub ↗

* Walks `program`'s named children with a single forward cursor (not an * index loop) — `extractComponent` consumes a variable run of FOLLOWING * siblings as the component body (see its doc comment), so this must * resume from whatever it last consumed rather than revisiting those same *

(root: SyntaxNode, fileNodeId: string)

Source from the content-addressed store, hash-verified

145 * cffunction/cfscript siblings a second time as bogus top-level symbols.
146 */
147 private walkProgram(root: SyntaxNode, fileNodeId: string): void {
148 let child: SyntaxNode | null = root.namedChild(0);
149 while (child) {
150 if (child.type === 'cf_component_open_tag') {
151 child = this.extractComponent(child, fileNodeId).nextSibling;
152 continue;
153 } else if (child.type === 'cf_function_tag') {
154 // A cffunction outside any cfcomponent wrapper (rare, but legal in a
155 // .cfm template) — extract as a top-level function, contained by the file.
156 this.extractFunctionTag(child, undefined, fileNodeId);
157 } else if (child.type === 'cf_script_tag') {
158 this.delegateScriptTag(child, fileNodeId);
159 } else if (child.type === 'cf_query_tag') {
160 this.delegateQueryTag(child, fileNodeId);
161 } else {
162 this.delegateNestedTags(child, fileNodeId);
163 }
164 child = child.nextSibling;
165 }
166 }
167
168 /**
169 * `<cfcomponent extends="Base" implements="IFoo,IBar">...</cfcomponent>`.

Callers 1

extractTagBasedMethod · 0.95

Calls 5

extractComponentMethod · 0.95
extractFunctionTagMethod · 0.95
delegateScriptTagMethod · 0.95
delegateQueryTagMethod · 0.95
delegateNestedTagsMethod · 0.95

Tested by

no test coverage detected