(content: string)
| 61 | * inline function expressions (which BrightScript supports inside tables). |
| 62 | */ |
| 63 | export function extractBrightScriptFunctions(content: string): ExportItem[] { |
| 64 | const exports: ExportItem[] = []; |
| 65 | const lines = content.split("\n"); |
| 66 | const declPattern = /^(function|sub)\s+([A-Za-z_][\w]*)\s*\(([^)]*)\)/i; |
| 67 | |
| 68 | const seen = new Set<string>(); |
| 69 | for (const line of lines) { |
| 70 | const m = line.match(declPattern); |
| 71 | if (!m) continue; |
| 72 | const kind = m[1].toLowerCase() === "sub" ? "sub" : "function"; |
| 73 | const name = m[2]; |
| 74 | const params = m[3].trim(); |
| 75 | if (seen.has(name)) continue; |
| 76 | seen.add(name); |
| 77 | exports.push({ |
| 78 | name, |
| 79 | kind: "function", |
| 80 | signature: `${kind} ${name}(${params})`, |
| 81 | }); |
| 82 | } |
| 83 | |
| 84 | return exports; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Extract observeField / observeFieldScoped registrations. |
no outgoing calls
no test coverage detected