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

Function cfmlConstructedComponent

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

Source from the content-addressed store, hash-verified

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