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

Function cfmlConstructedComponent

src/extraction/languages/cfscript.ts:96–106  ·  view source on GitHub ↗
(node: SyntaxNode, source: string)

Source from the content-addressed store, hash-verified

94 * `createObject(…)`, parenthesized or not (#2652).
95 */
96export function cfmlConstructedComponent(node: SyntaxNode, source: string): string | null {
97 let expr: SyntaxNode | null = node;
98 while (expr?.type === 'parenthesized_expression') expr = expr.namedChild(0);
99 if (!expr) return null;
100 if (expr.type === 'new_expression') {
101 const ctor = getChildByField(expr, 'constructor');
102 const name = ctor ? getNodeText(ctor, source).replace(/\s+/g, '') : '';
103 return COMPONENT_PATH.test(name) ? name : null;
104 }
105 return cfmlCreatedComponent(expr, source);
106}
107
108export const cfscriptExtractor: LanguageExtractor = {
109 functionTypes: ['function_declaration', 'function_expression', 'arrow_function'],

Callers 1

extractCallMethod · 0.90

Calls 3

getChildByFieldFunction · 0.90
getNodeTextFunction · 0.90
cfmlCreatedComponentFunction · 0.85

Tested by

no test coverage detected