(componentId: string)
| 146 | } |
| 147 | |
| 148 | private extractDirectives(componentId: string): void { |
| 149 | const lines = this.source.split('\n'); |
| 150 | for (let i = 0; i < lines.length; i++) { |
| 151 | const line = lines[i]!; |
| 152 | // `@model Foo` / `@inherits Bar<Foo>` — directive followed by a type. |
| 153 | const dir = line.match(/^\s*@(?:model|inherits)\s+([A-Za-z_][\w.]*(?:\s*<[^>]+>)?)/); |
| 154 | if (dir) for (const t of this.typeNames(dir[1]!)) this.pushRef(componentId, t, i + 1, 0); |
| 155 | // `@inject IService name` — the type is the first token, a name follows. |
| 156 | const inj = line.match(/^\s*@inject\s+([A-Za-z_][\w.]*(?:\s*<[^>]+>)?)\s+[A-Za-z_]/); |
| 157 | if (inj) for (const t of this.typeNames(inj[1]!)) this.pushRef(componentId, t, i + 1, 0); |
| 158 | // `@typeof(X)` anywhere on the line. |
| 159 | for (const m of line.matchAll(/@typeof\(\s*([A-Za-z_][\w.]*)\s*\)/g)) { |
| 160 | const seg = this.lastSegment(m[1]!); |
| 161 | if (/^[A-Z]/.test(seg)) this.pushRef(componentId, seg, i + 1, m.index ?? 0); |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | private extractComponentTags(componentId: string): void { |
| 167 | const lines = this.source.split('\n'); |
no test coverage detected