extract emitExportStar in separate function

This commit is contained in:
Vladimir Matveev
2015-04-28 20:17:55 -07:00
parent 3af5592243
commit 5f18d9b912
5 changed files with 84 additions and 58 deletions

View File

@@ -3,6 +3,7 @@ tests/cases/compiler/file2.ts(7,15): error TS2307: Cannot find module 'bar'.
tests/cases/compiler/file3.ts(2,25): error TS2307: Cannot find module 'a'.
tests/cases/compiler/file3.ts(3,15): error TS2307: Cannot find module 'bar'.
tests/cases/compiler/file4.ts(8,27): error TS2307: Cannot find module 'a'.
tests/cases/compiler/file5.ts(3,15): error TS2307: Cannot find module 'a'.
==== tests/cases/compiler/file1.ts (1 errors) ====
@@ -46,4 +47,11 @@ tests/cases/compiler/file4.ts(8,27): error TS2307: Cannot find module 'a'.
export {s, s1 as s2} from 'a'
~~~
!!! error TS2307: Cannot find module 'a'.
==== tests/cases/compiler/file5.ts (1 errors) ====
function foo() {}
export * from 'a';
~~~
!!! error TS2307: Cannot find module 'a'.

View File

@@ -31,7 +31,12 @@ export function foo() {}
var z, z1;
export {z, z1 as z2};
export {s, s1 as s2} from 'a'
export {s, s1 as s2} from 'a'
//// [file5.ts]
function foo() {}
export * from 'a';
//// [file1.js]
// set of tests cases that checks generation of local storage for exported names
@@ -40,19 +45,18 @@ System.register(['bar'], function(exports_1) {
function foo() { }
exports_1("foo", foo);
var exportedNames_1 = {
'x': void 0,
'foo': void 0
'x': true,
'foo': true
};
function exportStar_1(m, name) {
function exportStar_1(m) {
for(var n in m) {
if (!exportedNames_1.hasOwnProperty(n)) exportedNames_1[n] = name;
if (exportedNames_1[n] === name) exports_1(n, m[n]);
if (!exportedNames_1.hasOwnProperty(n)) exports_1(n, m[n]);
}
}
return {
setters:[
function (_bar_1) {
exportStar_1(_bar_1, 'bar');
exportStar_1(_bar_1);
}],
execute: function() {
exports_1("x", x);
@@ -63,19 +67,18 @@ System.register(['bar'], function(exports_1) {
System.register(['bar'], function(exports_1) {
var x, y;
var exportedNames_1 = {
'x': void 0,
'y1': void 0
'x': true,
'y1': true
};
function exportStar_1(m, name) {
function exportStar_1(m) {
for(var n in m) {
if (!exportedNames_1.hasOwnProperty(n)) exportedNames_1[n] = name;
if (exportedNames_1[n] === name) exports_1(n, m[n]);
if (!exportedNames_1.hasOwnProperty(n)) exports_1(n, m[n]);
}
}
return {
setters:[
function (_bar_1) {
exportStar_1(_bar_1, 'bar');
exportStar_1(_bar_1);
}],
execute: function() {
exports_1("x", x);
@@ -86,13 +89,12 @@ System.register(['bar'], function(exports_1) {
//// [file3.js]
System.register(['a', 'bar'], function(exports_1) {
var exportedNames_1 = {
'x': void 0,
'z': void 0
'x': true,
'z': true
};
function exportStar_1(m, name) {
function exportStar_1(m) {
for(var n in m) {
if (!exportedNames_1.hasOwnProperty(n)) exportedNames_1[n] = name;
if (exportedNames_1[n] === name) exports_1(n, m[n]);
if (!exportedNames_1.hasOwnProperty(n)) exports_1(n, m[n]);
}
}
return {
@@ -102,7 +104,7 @@ System.register(['a', 'bar'], function(exports_1) {
exports_1("z", _a_1["y"]);
},
function (_bar_1) {
exportStar_1(_bar_1, 'bar');
exportStar_1(_bar_1);
}],
execute: function() {
}
@@ -126,3 +128,20 @@ System.register(['a'], function(exports_1) {
}
}
});
//// [file5.js]
System.register(['a'], function(exports_1) {
function foo() { }
function exportStar_1(m) {
for(var n in m) {
exports_1(n, m[n]);
}
}
return {
setters:[
function (_a_1) {
exportStar_1(_a_1);
}],
execute: function() {
}
}
});

View File

@@ -26,13 +26,12 @@ System.register(['file1', 'file2', 'file3', 'file4', 'file5', 'file6', 'file7'],
var ns, file2_1, file3_1, file5_1, ns3;
var x, y;
var exportedNames_1 = {
'x': void 0,
'z': void 0
'x': true,
'z': true
};
function exportStar_1(m, name) {
function exportStar_1(m) {
for(var n in m) {
if (!exportedNames_1.hasOwnProperty(n)) exportedNames_1[n] = name;
if (exportedNames_1[n] === name) exports_1(n, m[n]);
if (!exportedNames_1.hasOwnProperty(n)) exports_1(n, m[n]);
}
}
return {
@@ -54,7 +53,7 @@ System.register(['file1', 'file2', 'file3', 'file4', 'file5', 'file6', 'file7'],
ns3 = _ns3;
},
function (_file7_1) {
exportStar_1(_file7_1, 'file7');
exportStar_1(_file7_1);
}],
execute: function() {
ns.f();

View File

@@ -31,4 +31,9 @@ export function foo() {}
var z, z1;
export {z, z1 as z2};
export {s, s1 as s2} from 'a'
export {s, s1 as s2} from 'a'
// @filename: file5.ts
function foo() {}
export * from 'a';