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