Instead of setting fresh value, or the value with existing one of if alias is referenced in value position

Fixes #1130
This commit is contained in:
Sheetal Nandi 2014-11-11 23:49:57 -08:00
parent ce51343e73
commit b1297b2b65
3 changed files with 3 additions and 1 deletions

View file

@ -4474,7 +4474,7 @@ module ts {
if (symbol.flags & SymbolFlags.Import) {
// Mark the import as referenced so that we emit it in the final .js file.
// exception: identifiers that appear in type queries, const enums, modules that contain only const enums
getSymbolLinks(symbol).referenced = !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol));
getSymbolLinks(symbol).referenced = getSymbolLinks(symbol).referenced || (!isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol)));
}
checkCollisionWithCapturedSuperVariable(node, node);

View file

@ -50,6 +50,7 @@ var VisualizationModel = (function (_super) {
})(Backbone.Model);
exports.VisualizationModel = VisualizationModel;
//// [aliasUsageInIndexerOfClass_main.js]
var moduleA = require("aliasUsageInIndexerOfClass_moduleA");
var N = (function () {
function N() {
this.x = moduleA;

View file

@ -20,6 +20,7 @@ exports.main = 10;
//// [elidingImportNames_main1.js]
exports.main = 10;
//// [elidingImportNames_test.js]
var a = require('elidingImportNames_main'); // alias used in typeof
var b = a;
var x;
var a2 = require('elidingImportNames_main1'); // alias not used in typeof