(node: SyntaxNode, source: string)
| 95 | * `createObject(…)`, parenthesized or not (#2652). |
| 96 | */ |
| 97 | export 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 | |
| 109 | export const cfscriptExtractor: LanguageExtractor = { |
| 110 | functionTypes: ['function_declaration', 'function_expression', 'arrow_function'], |
no test coverage detected