mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Lookup files by resolved Path and not by fileName in sourcemapDecoder when querying program (#25908)
* Check if the file returned by the program actually refers to the same file as we intend * Simplify
This commit is contained in:
@@ -98,10 +98,10 @@ namespace ts.sourcemaps {
|
||||
|
||||
function getSourceFileLike(fileName: string, location: string): SourceFileLike | undefined {
|
||||
// Lookup file in program, if provided
|
||||
const file = program && program.getSourceFile(fileName);
|
||||
const path = toPath(fileName, location, host.getCanonicalFileName);
|
||||
const file = program && program.getSourceFile(path);
|
||||
if (!file) {
|
||||
// Otherwise check the cache (which may hit disk)
|
||||
const path = toPath(fileName, location, host.getCanonicalFileName);
|
||||
return fallbackCache.get(path);
|
||||
}
|
||||
return file;
|
||||
|
||||
Reference in New Issue
Block a user