(node: SyntaxNode, source: string, filePath: string)
| 51 | let lastFnId = ''; |
| 52 | |
| 53 | function moduleExports(node: SyntaxNode, source: string, filePath: string): Set<string> | 'all' { |
| 54 | if (filePath === exportsFile) return exportsMemo; |
| 55 | let root: SyntaxNode = node; |
| 56 | while (root.parent) root = root.parent; |
| 57 | let result: Set<string> | 'all' = new Set<string>(); |
| 58 | for (let i = 0; i < root.namedChildCount; i++) { |
| 59 | const form = root.namedChild(i); |
| 60 | if (!form) continue; |
| 61 | if ( |
| 62 | form.type === 'compile_options_attribute' && |
| 63 | getNodeText(form, source).includes('export_all') |
| 64 | ) { |
| 65 | result = 'all'; |
| 66 | break; |
| 67 | } |
| 68 | if (form.type === 'export_attribute') { |
| 69 | for (const fa of form.namedChildren) { |
| 70 | if (fa.type !== 'fa') continue; |
| 71 | const fun = getChildByField(fa, 'fun'); |
| 72 | if (fun) result.add(atomText(fun, source)); |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | exportsFile = filePath; |
| 77 | exportsMemo = result; |
| 78 | return result; |
| 79 | } |
| 80 | |
| 81 | /** The -spec directly above a function (comments may sit between), if it names it. */ |
| 82 | function precedingSpec(node: SyntaxNode, name: string, source: string): SyntaxNode | null { |
no test coverage detected