A file's lines as code (see vbCode), read once per file.
(file: string, context: ResolutionContext)
| 201 | |
| 202 | /** A file's lines as code (see vbCode), read once per file. */ |
| 203 | function codeLines(file: string, context: ResolutionContext): string[] { |
| 204 | let memo = VB_CODE_LINES.get(context); |
| 205 | if (!memo) VB_CODE_LINES.set(context, (memo = new Map())); |
| 206 | const hit = memo.get(file); |
| 207 | if (hit) return hit; |
| 208 | const lines = (context.getFileLines?.(file) ?? context.readFile(file)?.split(/\r?\n/) ?? []).map(vbCode); |
| 209 | if (memo.size >= 1024) memo.delete(memo.keys().next().value!); |
| 210 | memo.set(file, lines); |
| 211 | return lines; |
| 212 | } |
| 213 | |
| 214 | interface VbPatterns { |
| 215 | /** The name standing where a binding names it — not as `name.Member` nor `name(args)`, which only use it. */ |
no test coverage detected