mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Remove the --noResolve check when finding the file.
--noResolve is only for ///reference and import file resolution to resolve files from disk but the file identity is always determined before creating duplicate source file for same file paths
This commit is contained in:
1 parent
264bd5db7c
commit
7d103a1a45
16 files changed
+131
-10
No files matched your search
+8
-10
@@ -4427,13 +4427,10 @@ module ts {
|
||||
return getSourceFileFromCache(filename, canonicalName, /*useAbsolutePath*/ false);
|
||||
}
|
||||
else {
|
||||
// if --noResolve is not specified check if we have file for absolute path
|
||||
if (!options.noResolve) {
|
||||
var normalizedAbsolutePath = getNormalizedAbsolutePath(filename, host.getCurrentDirectory());
|
||||
var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath);
|
||||
if (hasProperty(filesByName, canonicalAbsolutePath)) {
|
||||
return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, /*useAbsolutePath*/ true);
|
||||
}
|
||||
var normalizedAbsolutePath = getNormalizedAbsolutePath(filename, host.getCurrentDirectory());
|
||||
var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath);
|
||||
if (hasProperty(filesByName, canonicalAbsolutePath)) {
|
||||
return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, /*useAbsolutePath*/ true);
|
||||
}
|
||||
|
||||
// We haven't looked for this file, do so now and cache result
|
||||
@@ -4443,10 +4440,11 @@ module ts {
|
||||
});
|
||||
if (file) {
|
||||
seenNoDefaultLib = seenNoDefaultLib || file.hasNoDefaultLib;
|
||||
if (!options.noResolve) {
|
||||
// Set the source file for normalized absolute path
|
||||
filesByName[canonicalAbsolutePath] = file;
|
||||
|
||||
// Set the source file for normalized absolute path
|
||||
filesByName[canonicalAbsolutePath] = file;
|
||||
|
||||
if (!options.noResolve) {
|
||||
var basePath = getDirectoryPath(filename);
|
||||
processReferencedFiles(file, basePath);
|
||||
processImportedModules(file, basePath);
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
var test = (function () {
|
||||
function test() {
|
||||
}
|
||||
return test;
|
||||
})();
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
declare class test {
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"scenario": "referenceResolutionSameFileTwice",
|
||||
"projectRoot": "tests/cases/projects/ReferenceResolution/",
|
||||
"inputFiles": [
|
||||
"test.ts",
|
||||
"../ReferenceResolution/test.ts"
|
||||
],
|
||||
"declaration": true,
|
||||
"baselineCheck": true,
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"test.ts"
|
||||
],
|
||||
"emittedFiles": [
|
||||
"test.js",
|
||||
"test.d.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
var test = (function () {
|
||||
function test() {
|
||||
}
|
||||
return test;
|
||||
})();
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
declare class test {
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"scenario": "referenceResolutionSameFileTwice",
|
||||
"projectRoot": "tests/cases/projects/ReferenceResolution/",
|
||||
"inputFiles": [
|
||||
"test.ts",
|
||||
"../ReferenceResolution/test.ts"
|
||||
],
|
||||
"declaration": true,
|
||||
"baselineCheck": true,
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"test.ts"
|
||||
],
|
||||
"emittedFiles": [
|
||||
"test.js",
|
||||
"test.d.ts"
|
||||
]
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
var test = (function () {
|
||||
function test() {
|
||||
}
|
||||
return test;
|
||||
})();
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
declare class test {
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"scenario": "referenceResolutionSameFileTwice_NoResolve",
|
||||
"projectRoot": "tests/cases/projects/ReferenceResolution/",
|
||||
"inputFiles": [
|
||||
"test.ts",
|
||||
"../ReferenceResolution/test.ts"
|
||||
],
|
||||
"declaration": true,
|
||||
"baselineCheck": true,
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"test.ts"
|
||||
],
|
||||
"emittedFiles": [
|
||||
"test.js",
|
||||
"test.d.ts"
|
||||
]
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
var test = (function () {
|
||||
function test() {
|
||||
}
|
||||
return test;
|
||||
})();
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
declare class test {
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"scenario": "referenceResolutionSameFileTwice_NoResolve",
|
||||
"projectRoot": "tests/cases/projects/ReferenceResolution/",
|
||||
"inputFiles": [
|
||||
"test.ts",
|
||||
"../ReferenceResolution/test.ts"
|
||||
],
|
||||
"declaration": true,
|
||||
"baselineCheck": true,
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"test.ts"
|
||||
],
|
||||
"emittedFiles": [
|
||||
"test.js",
|
||||
"test.d.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"scenario": "referenceResolutionSameFileTwice",
|
||||
"projectRoot": "tests/cases/projects/ReferenceResolution/",
|
||||
"inputFiles": [
|
||||
"test.ts",
|
||||
"../ReferenceResolution/test.ts"
|
||||
],
|
||||
"declaration": true,
|
||||
"baselineCheck": true
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"scenario": "referenceResolutionSameFileTwice_NoResolve",
|
||||
"projectRoot": "tests/cases/projects/ReferenceResolution/",
|
||||
"inputFiles": [
|
||||
"test.ts",
|
||||
"../ReferenceResolution/test.ts"
|
||||
],
|
||||
"noResolve": true,
|
||||
"declaration": true,
|
||||
"baselineCheck": true
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
class test {
|
||||
}
|
||||
Reference in new issue
Block a user