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

Method extractFunctionTag

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

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