(
caller: { filePath: string; language: Language },
site: { line?: number; column?: number }
)
| 184 | // Named rather than a method, because `createWhenReader` hands `when` out |
| 185 | // detached: it must not depend on `this`. |
| 186 | const guards = async ( |
| 187 | caller: { filePath: string; language: Language }, |
| 188 | site: { line?: number; column?: number } |
| 189 | ): Promise<BranchGuard[]> => { |
| 190 | if (!site.line || sites >= maxSites || !supportsBranchGuards(caller.language)) return []; |
| 191 | const file = resolve(caller); |
| 192 | if (!file) return []; |
| 193 | sites++; |
| 194 | const key = { line: site.line, column: typeof site.column === 'number' ? site.column : null }; |
| 195 | return (await guardsForFile(file.abs, file.language, [key])).get(siteKey(key)) ?? []; |
| 196 | }; |
| 197 | return { |
| 198 | guards, |
| 199 | async when(caller, site) { |
no test coverage detected