From b40512d8a21f5dd66df4b4c5a4940b68509effb9 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 30 Jun 2016 01:00:53 -0700 Subject: [PATCH] Only mark symbols found in a local symbol table --- src/compiler/checker.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f42ca9ffe34..0bedc9f404a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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; }