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

Method extractFunctionTag

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

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

Callers 2

walkProgramMethod · 0.95
extractComponentMethod · 0.95

Calls 4

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

Tested by

no test coverage detected