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

Method extractBareScript

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

61
62 /** Modern bare-script `.cfc`/`.cfm`: delegate the whole file to the cfscript grammar. */
63 private extractBareScript(): void {
64 const extractor = new TreeSitterExtractor(this.filePath, this.source, 'cfscript');
65 const result = extractor.extract();
66
67 // cfscript's `component`/`interface` node has no `name` field — a CFC's
68 // component name is always implicit from its file name, never declared
69 // in source — so the generic extractor names it '<anonymous>'.
70 const componentName = this.componentNameFromPath();
71 for (const node of result.nodes) {
72 node.language = this.language;
73 if (node.name === '<anonymous>' && (node.kind === 'class' || node.kind === 'interface')) {
74 node.name = componentName;
75 node.qualifiedName = `${this.filePath}::${componentName}`;
76 } else if (node.qualifiedName === '<anonymous>' || node.qualifiedName.startsWith('<anonymous>::')) {
77 // Members were scoped under the anonymous component (`<anonymous>::save`)
78 // — carry the rename into their scope chains so type-validated method
79 // resolution (which wants `UserService::save`, see resolveMethodOnType)
80 // can match them. Inner genuinely-anonymous segments are untouched.
81 node.qualifiedName = componentName + node.qualifiedName.slice('<anonymous>'.length);
82 }
83 this.nodes.push(node);
84 }
85 this.edges.push(...result.edges);
86 for (const ref of result.unresolvedReferences) {
87 ref.language = this.language;
88 this.unresolvedReferences.push(ref);
89 }
90 this.errors.push(...result.errors);
91 }
92
93 /** Legacy tag-based CFML: walk `<cfcomponent>`/`<cffunction>`, delegating `<cfscript>` bodies. */
94 private extractTagBased(): void {

Callers 1

extractMethod · 0.95

Calls 2

extractMethod · 0.95
componentNameFromPathMethod · 0.95

Tested by

no test coverage detected