From f751901eee100fea85bf17917700e4d465e50ede Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 29 Jun 2016 23:46:41 -0700 Subject: [PATCH] Consolidate refernce marking in resolveName to allow marking aliases correctelly --- src/compiler/checker.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d593683a2a9..40ff595b0ad 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -899,6 +899,10 @@ namespace ts { error(errorLocation, Diagnostics.Identifier_0_must_be_imported_from_a_module, name); } } + + if (result && noUnusedIdentifiers && !isInAmbientContext(location)) { + result.hasReference = true; + } } return result; } @@ -4961,10 +4965,6 @@ namespace ts { // type reference in checkTypeReferenceOrExpressionWithTypeArguments. links.resolvedSymbol = symbol; links.resolvedType = type; - - if (noUnusedIdentifiers && symbol !== unknownSymbol && !isInAmbientContext(node)) { - symbol.hasReference = true; - } } return links.resolvedType; } @@ -8327,9 +8327,6 @@ namespace ts { function checkIdentifier(node: Identifier): Type { const symbol = getResolvedSymbol(node); - if (symbol && noUnusedIdentifiers && !isInAmbientContext(node)) { - symbol.hasReference = true; - } // As noted in ECMAScript 6 language spec, arrow functions never have an arguments objects. // Although in down-level emit of arrow function, we emit it using function expression which means that @@ -16674,9 +16671,6 @@ namespace ts { if (target.flags & SymbolFlags.Type) { checkTypeNameIsReserved(node.name, Diagnostics.Import_name_cannot_be_0); } - if (noUnusedIdentifiers && !isInAmbientContext(node)) { - target.hasReference = true; - } } } else {