fix: push exported variable when hoisting export declared names (#12110)

This commit is contained in:
Huáng Jùnliàng 2020-09-28 11:38:39 -04:00 committed by GitHub
parent a080c82777
commit 62df8d2b79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 10 deletions

View File

@ -506,10 +506,12 @@ export default declare((api, options) => {
path,
(id, name, hasInit) => {
variableIds.push(id);
if (!hasInit) {
exportNames.push(name);
if (!hasInit && name in exportMap) {
for (const exported of exportMap[name]) {
exportNames.push(exported);
exportValues.push(scope.buildUndefinedNode());
}
}
},
null,
);

View File

@ -3,7 +3,7 @@ System.register([], function (_export, _context) {
var foo;
_export("foo", void 0);
_export("bar", void 0);
return {
setters: [],

View File

@ -3,7 +3,7 @@ System.register([], function (_export, _context) {
var foo;
_export("foo", void 0);
_export("default", void 0);
return {
setters: [],

View File

@ -4,7 +4,7 @@ System.register([], function (_export, _context) {
var foo, bar;
_export({
foo: void 0,
default: void 0,
bar: void 0
});

View File

@ -7,10 +7,7 @@ System.register(["./evens"], function (_export, _context) {
return _export("p", p = isEven(n) ? n + 1 : n + 2);
}
_export({
nextOdd: nextOdd,
a: void 0
});
_export("nextOdd", nextOdd);
return {
setters: [function (_evens) {