(sourceFile: ts.SourceFile)
| 113 | } |
| 114 | |
| 115 | function extractRenderElements(sourceFile: ts.SourceFile): string[] { |
| 116 | const elements: string[] = []; |
| 117 | |
| 118 | function visit(node: ts.Node): void { |
| 119 | if (ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node)) { |
| 120 | const tagName = node.tagName.getText(sourceFile); |
| 121 | elements.push(tagName); |
| 122 | } |
| 123 | ts.forEachChild(node, visit); |
| 124 | } |
| 125 | |
| 126 | const onRender = findMethod(sourceFile, 'onRender'); |
| 127 | if (onRender) { |
| 128 | ts.forEachChild(onRender, visit); |
| 129 | } |
| 130 | |
| 131 | return elements; |
| 132 | } |
| 133 | |
| 134 | function findMethod(sourceFile: ts.SourceFile, methodName: string): ts.Node | undefined { |
| 135 | for (const statement of sourceFile.statements) { |
no test coverage detected