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

Method extractFunctionTag

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

345 * generic extractor produces) so type-validated method resolution can match.
346 */
347 private extractFunctionTag(tag: SyntaxNode, parentClassId: string | undefined, containerId: string | undefined, parentClassName?: string): void {
348 const name = this.tagAttr(tag, 'name');
349 if (!name) return;
350
351 const kind = parentClassId ? 'method' : 'function';
352 const id = this.nodeIds.generate(this.filePath, kind, name, tag.startPosition.row + 1, tag.startPosition.column);
353 const access = this.tagAttr(tag, 'access');
354 const visibility = access === 'private' ? 'private'
355 : access === 'package' ? 'internal'
356 : access ? 'public'
357 : undefined;
358
359 const fnNode: Node = {
360 id,
361 kind,
362 name,
363 qualifiedName: parentClassName ? `${parentClassName}::${name}` : `${this.filePath}::${name}`,
364 filePath: this.filePath,
365 language: this.language,
366 startLine: tag.startPosition.row + 1,
367 endLine: tag.endPosition.row + 1,
368 startColumn: tag.startPosition.column,
369 endColumn: tag.endPosition.column,
370 visibility,
371 returnType: this.tagAttr(tag, 'returntype'),
372 updatedAt: Date.now(),
373 };
374 this.nodes.push(fnNode);
375
376 if (containerId) {
377 this.edges.push({ source: containerId, target: fnNode.id, kind: 'contains' });
378 }
379
380 // Walk the body, at any depth (e.g. inside <cfif>/<cfloop>/<cftry>
381 // control-flow tags): its <cfscript>/<cfquery> bodies and tag
382 // expressions are this function's.
383 this.delegateNestedTags(tag, fnNode.id);
384 }
385
386 /**
387 * Visit one node of tag markup. `containerId` is the scope the node sits in

Callers 1

visitTagMethod · 0.95

Calls 4

tagAttrMethod · 0.95
delegateNestedTagsMethod · 0.95
pushMethod · 0.80
generateMethod · 0.45

Tested by

no test coverage detected