( name: string, file: string, line: number, language: UnresolvedRef['language'], context: ResolutionContext )
| 104 | * REDISMODULE_CORE, and not in a module that includes the same header. |
| 105 | */ |
| 106 | export function isCppMacroDefinedAt( |
| 107 | name: string, |
| 108 | file: string, |
| 109 | line: number, |
| 110 | language: UnresolvedRef['language'], |
| 111 | context: ResolutionContext |
| 112 | ): boolean { |
| 113 | const cache = cacheFor(context); |
| 114 | const key = `${language}\0${file}\0${name}`; |
| 115 | let timeline = cache.watched.get(key); |
| 116 | if (!timeline) cache.watched.set(key, (timeline = walkTranslationUnit(file, language, context, cache, name))); |
| 117 | if (line >= timeline.cutoff) return false; |
| 118 | const before = (timeline.events.get(name) ?? []).filter((e) => e.line <= line); |
| 119 | return before.length > 0 && before[before.length - 1]!.defined === true; |
| 120 | } |
| 121 | |
| 122 | function cacheFor(context: ResolutionContext): Cache { |
| 123 | let cache = memo.get(context); |
no test coverage detected