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

Method extractFunctionTag

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

* ` ... `. * `parentClassId` decides `method` vs top-level `function`; `containerId` is * the `contains`-edge target (the class when inside one, otherwise the file * node for a bare top-level cffunction) — kept separate so a to

(tag: SyntaxNode, parentClassId: string | undefined, containerId: string | undefined, parentClassName?: string)

Source from the content-addressed store, hash-verified

257 * generic extractor produces) so type-validated method resolution can match.
258 */
259 private extractFunctionTag(tag: SyntaxNode, parentClassId: string | undefined, containerId: string | undefined, parentClassName?: string): void {
260 const name = this.tagAttr(tag, 'name');
261 if (!name) return;
262
263 const kind = parentClassId ? 'method' : 'function';
264 const id = generateNodeId(this.filePath, kind, name, tag.startPosition.row + 1);
265 const access = this.tagAttr(tag, 'access');
266 const visibility = access === 'private' ? 'private'
267 : access === 'package' ? 'internal'
268 : access ? 'public'
269 : undefined;
270
271 const fnNode: Node = {
272 id,
273 kind,
274 name,
275 qualifiedName: parentClassName ? `${parentClassName}::${name}` : `${this.filePath}::${name}`,
276 filePath: this.filePath,
277 language: this.language,
278 startLine: tag.startPosition.row + 1,
279 endLine: tag.endPosition.row + 1,
280 startColumn: tag.startPosition.column,
281 endColumn: tag.endPosition.column,
282 visibility,
283 returnType: this.tagAttr(tag, 'returntype'),
284 updatedAt: Date.now(),
285 };
286 this.nodes.push(fnNode);
287
288 if (containerId) {
289 this.edges.push({ source: containerId, target: fnNode.id, kind: 'contains' });
290 }
291
292 // Delegate any <cfscript>/<cfquery> bodies nested inside this function, at
293 // any depth (e.g. inside <cfif>/<cfloop>/<cftry> control-flow tags).
294 this.delegateNestedTags(tag, fnNode.id);
295 }
296
297 /**
298 * Recursively delegates any `cf_script_tag`/`cf_query_tag` found within

Callers 2

walkProgramMethod · 0.95
extractComponentMethod · 0.95

Calls 3

tagAttrMethod · 0.95
delegateNestedTagsMethod · 0.95
generateNodeIdFunction · 0.90

Tested by

no test coverage detected