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

Method extractBareScript

src/extraction/cfml-extractor.ts:118–146  ·  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

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

Callers 1

extractMethod · 0.95

Calls 4

extractMethod · 0.95
componentNameFromPathMethod · 0.95
pushAllFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected