Fix crash on missing parent pointer in binder when transpiling export as ns (#36387)

This commit is contained in:
Wesley Wigham
2020-01-24 13:36:05 -08:00
committed by GitHub
parent 751eb44e21
commit 6b64c883f1
4 changed files with 22 additions and 0 deletions
+3
View File
@@ -2608,6 +2608,9 @@ namespace ts {
declareSymbol(container.symbol.exports, container.symbol, node, SymbolFlags.ExportStar, SymbolFlags.None);
}
else if (isNamespaceExport(node.exportClause)) {
// declareSymbol walks up parents to find name text, parent _must_ be set
// but won't be set by the normal binder walk until `bindChildren` later on.
node.exportClause.parent = node;
declareSymbol(container.symbol.exports, container.symbol, node.exportClause, SymbolFlags.Alias, SymbolFlags.AliasExcludes);
}
}
@@ -474,5 +474,12 @@ var x = 0;`, {
transpilesCorrectly("Infer correct file extension", `const fn = <T>(a: T) => a`, {
noSetFileName: true
});
transpilesCorrectly("Export star as ns conflict does not crash", `
var a;
export { a as alias };
export * as alias from './file';`, {
noSetFileName: true
});
});
}
@@ -0,0 +1,6 @@
"use strict";
exports.__esModule = true;
var a;
exports.alias = a;
exports.alias = require("./file");
//# sourceMappingURL=module.js.map
@@ -0,0 +1,6 @@
"use strict";
exports.__esModule = true;
var a;
exports.alias = a;
exports.alias = require("./file");
//# sourceMappingURL=module.js.map