* Resolve a C/C++ include path by searching include directories. * Called as a fallback after relative and aliased resolution fail.
( importPath: string, language: Language, context: ResolutionContext )
| 509 | * Called as a fallback after relative and aliased resolution fail. |
| 510 | */ |
| 511 | function resolveCppIncludePath( |
| 512 | importPath: string, |
| 513 | language: Language, |
| 514 | context: ResolutionContext |
| 515 | ): string | null { |
| 516 | const includeDirs = context.getCppIncludeDirs?.() ?? []; |
| 517 | const extensions = EXTENSION_RESOLUTION[language] ?? []; |
| 518 | |
| 519 | for (const dir of includeDirs) { |
| 520 | const normalizedDir = dir.replace(/\\/g, '/'); |
| 521 | for (const ext of extensions) { |
| 522 | const candidate = normalizedDir + '/' + importPath + ext; |
| 523 | if (context.fileExists(candidate)) return candidate; |
| 524 | } |
| 525 | // Try as-is (already has extension) |
| 526 | const candidate = normalizedDir + '/' + importPath; |
| 527 | if (context.fileExists(candidate)) return candidate; |
| 528 | } |
| 529 | |
| 530 | return null; |
| 531 | } |
| 532 | |
| 533 | /** |
| 534 | * Is this reference a PHP include/require PATH (vs a namespace `use` symbol)? |
no test coverage detected