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

Method extractBareScript

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

Modern bare-script `.cfc`/`.cfm`: delegate the whole file to the cfscript grammar.

()

Source from the content-addressed store, hash-verified

114
115 /** Modern bare-script `.cfc`/`.cfm`: delegate the whole file to the cfscript grammar. */
116 private extractBareScript(): void {
117 const extractor = new TreeSitterExtractor(this.filePath, this.source, 'cfscript');
118 const result = extractor.extract();
119
120 // cfscript's `component`/`interface` node has no `name` field — a CFC's
121 // component name is always implicit from its file name, never declared
122 // in source — so the generic extractor names it '<anonymous>'.
123 const componentName = this.componentNameFromPath();
124 for (const node of result.nodes) {
125 node.language = this.language;
126 if (node.name === '<anonymous>' && (node.kind === 'class' || node.kind === 'interface')) {
127 node.name = componentName;
128 node.qualifiedName = `${this.filePath}::${componentName}`;
129 } else if (node.qualifiedName === '<anonymous>' || node.qualifiedName.startsWith('<anonymous>::')) {
130 // Members were scoped under the anonymous component (`<anonymous>::save`)
131 // — carry the rename into their scope chains so type-validated method
132 // resolution (which wants `UserService::save`, see resolveMethodOnType)
133 // can match them. Inner genuinely-anonymous segments are untouched.
134 node.qualifiedName = componentName + node.qualifiedName.slice('<anonymous>'.length);
135 }
136 this.nodes.push(node);
137 }
138 this.edges.push(...result.edges);
139 for (const ref of result.unresolvedReferences) {
140 ref.language = this.language;
141 this.unresolvedReferences.push(ref);
142 }
143 this.errors.push(...result.errors);
144 }
145
146 /** Legacy tag-based CFML: walk `<cfcomponent>`/`<cffunction>`, delegating `<cfscript>` bodies. */
147 private extractTagBased(): void {

Callers 1

extractMethod · 0.95

Calls 3

extractMethod · 0.95
componentNameFromPathMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected