Only mark symbols found in a local symbol table

This commit is contained in:
Mohamed Hegazy
2016-06-30 01:00:53 -07:00
parent 3d9c9206e4
commit b40512d8a2

View File

@@ -51,7 +51,7 @@ namespace ts {
const compilerOptions = host.getCompilerOptions();
const languageVersion = compilerOptions.target || ScriptTarget.ES3;
const modulekind = getEmitModuleKind(compilerOptions);
const noUnusedIdentifiers = compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters;
const noUnusedIdentifiers = !!compilerOptions.noUnusedLocals || !!compilerOptions.noUnusedParameters;
const allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ModuleKind.System;
const strictNullChecks = compilerOptions.strictNullChecks;
@@ -849,6 +849,10 @@ namespace ts {
location = location.parent;
}
if (result && nameNotFoundMessage && noUnusedIdentifiers) {
result.isReferenced = true;
}
if (!result) {
result = getSymbol(globals, name, meaning);
}
@@ -899,10 +903,6 @@ namespace ts {
error(errorLocation, Diagnostics.Identifier_0_must_be_imported_from_a_module, name);
}
}
if (result && noUnusedIdentifiers && !isInAmbientContext(location)) {
result.isReferenced = true;
}
}
return result;
}