mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
generate local storage for all exported names to avoid overwriting them via star exports
This commit is contained in:
@@ -15,14 +15,14 @@ System.register(['file1', 'file2'], function(exports_1) {
|
||||
return {
|
||||
setters:[
|
||||
function (_file1_1) {
|
||||
file1_1 = _file1_1
|
||||
file1_1 = _file1_1;
|
||||
exports_1("n", file1_1["default"]);
|
||||
exports_1("n1", file1_1["default"]);
|
||||
exports_1("x", file1_1.x);
|
||||
exports_1("y", file1_1.x);
|
||||
},
|
||||
function (_n2) {
|
||||
n2 = _n2
|
||||
n2 = _n2;
|
||||
exports_1("n2", n2);
|
||||
exports_1("n3", n2);
|
||||
}],
|
||||
|
||||
@@ -15,14 +15,14 @@ System.register(['file1', 'file2'], function(exports_1) {
|
||||
return {
|
||||
setters:[
|
||||
function (_file1_1) {
|
||||
file1_1 = _file1_1
|
||||
file1_1 = _file1_1;
|
||||
exports_1("n", file1_1.default);
|
||||
exports_1("n1", file1_1.default);
|
||||
exports_1("x", file1_1.x);
|
||||
exports_1("y", file1_1.x);
|
||||
},
|
||||
function (_n2) {
|
||||
n2 = _n2
|
||||
n2 = _n2;
|
||||
exports_1("n2", n2);
|
||||
exports_1("n3", n2);
|
||||
}],
|
||||
|
||||
@@ -1,11 +1,49 @@
|
||||
tests/cases/compiler/systemModule11.ts(3,17): error TS2307: Cannot find external module 'bar'.
|
||||
tests/cases/compiler/file1.ts(7,15): error TS2307: Cannot find external module 'bar'.
|
||||
tests/cases/compiler/file2.ts(7,15): error TS2307: Cannot find external module 'bar'.
|
||||
tests/cases/compiler/file3.ts(2,25): error TS2307: Cannot find external module 'a'.
|
||||
tests/cases/compiler/file3.ts(3,15): error TS2307: Cannot find external module 'bar'.
|
||||
tests/cases/compiler/file4.ts(8,27): error TS2307: Cannot find external module 'a'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/systemModule11.ts (1 errors) ====
|
||||
==== tests/cases/compiler/file1.ts (1 errors) ====
|
||||
|
||||
import 'foo'
|
||||
import {f} from 'bar';
|
||||
~~~~~
|
||||
// set of tests cases that checks generation of local storage for exported names
|
||||
|
||||
|
||||
export var x;
|
||||
export function foo() {}
|
||||
export * from 'bar';
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find external module 'bar'.
|
||||
|
||||
f();
|
||||
==== tests/cases/compiler/file2.ts (1 errors) ====
|
||||
|
||||
var x;
|
||||
var y;
|
||||
export {x};
|
||||
export {y as y1}
|
||||
|
||||
export * from 'bar';
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find external module 'bar'.
|
||||
|
||||
==== tests/cases/compiler/file3.ts (2 errors) ====
|
||||
|
||||
export {x, y as z} from 'a';
|
||||
~~~
|
||||
!!! error TS2307: Cannot find external module 'a'.
|
||||
export * from 'bar';
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find external module 'bar'.
|
||||
|
||||
==== tests/cases/compiler/file4.ts (1 errors) ====
|
||||
|
||||
export var x;
|
||||
export function foo() {}
|
||||
|
||||
var z, z1;
|
||||
export {z, z1 as z2};
|
||||
|
||||
export {s, s1 as s2} from 'a'
|
||||
~~~
|
||||
!!! error TS2307: Cannot find external module 'a'.
|
||||
@@ -1,21 +1,113 @@
|
||||
//// [systemModule11.ts]
|
||||
|
||||
import 'foo'
|
||||
import {f} from 'bar';
|
||||
|
||||
f();
|
||||
//// [tests/cases/compiler/systemModule11.ts] ////
|
||||
|
||||
//// [systemModule11.js]
|
||||
System.register(['foo', 'bar'], function(exports_1) {
|
||||
var bar_1;
|
||||
//// [file1.ts]
|
||||
|
||||
// set of tests cases that checks generation of local storage for exported names
|
||||
|
||||
|
||||
export var x;
|
||||
export function foo() {}
|
||||
export * from 'bar';
|
||||
|
||||
//// [file2.ts]
|
||||
|
||||
var x;
|
||||
var y;
|
||||
export {x};
|
||||
export {y as y1}
|
||||
|
||||
export * from 'bar';
|
||||
|
||||
//// [file3.ts]
|
||||
|
||||
export {x, y as z} from 'a';
|
||||
export * from 'bar';
|
||||
|
||||
//// [file4.ts]
|
||||
|
||||
export var x;
|
||||
export function foo() {}
|
||||
|
||||
var z, z1;
|
||||
export {z, z1 as z2};
|
||||
|
||||
export {s, s1 as s2} from 'a'
|
||||
|
||||
//// [file1.js]
|
||||
// set of tests cases that checks generation of local storage for exported names
|
||||
System.register(['bar'], function(exports_1) {
|
||||
var x;
|
||||
function foo() { }
|
||||
exports_1("foo", foo);
|
||||
var exportedNames_1 = {
|
||||
'x': true,
|
||||
'foo': true
|
||||
};
|
||||
return {
|
||||
setters:[
|
||||
function (_) {},
|
||||
function (_bar_1) {
|
||||
bar_1 = _bar_1
|
||||
for (var n in _bar_1)
|
||||
if (!exportedNames_1.hasOwnProperty(n)) exports_1(n, _bar_1[n]);
|
||||
}],
|
||||
execute: function() {
|
||||
bar_1.f();
|
||||
exports_1("x", x);
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [file2.js]
|
||||
System.register(['bar'], function(exports_1) {
|
||||
var x, y;
|
||||
var exportedNames_1 = {
|
||||
'x': true,
|
||||
'y1': true
|
||||
};
|
||||
return {
|
||||
setters:[
|
||||
function (_bar_1) {
|
||||
for (var n in _bar_1)
|
||||
if (!exportedNames_1.hasOwnProperty(n)) exports_1(n, _bar_1[n]);
|
||||
}],
|
||||
execute: function() {
|
||||
exports_1("x", x);
|
||||
exports_1("y1", y);
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [file3.js]
|
||||
System.register(['a', 'bar'], function(exports_1) {
|
||||
var exportedNames_1 = {
|
||||
'x': true,
|
||||
'z': true
|
||||
};
|
||||
return {
|
||||
setters:[
|
||||
function (_a_1) {
|
||||
exports_1("x", _a_1["x"]);
|
||||
exports_1("z", _a_1["y"]);
|
||||
},
|
||||
function (_bar_1) {
|
||||
for (var n in _bar_1)
|
||||
if (!exportedNames_1.hasOwnProperty(n)) exports_1(n, _bar_1[n]);
|
||||
}],
|
||||
execute: function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [file4.js]
|
||||
System.register(['a'], function(exports_1) {
|
||||
var x, z, z1;
|
||||
function foo() { }
|
||||
exports_1("foo", foo);
|
||||
return {
|
||||
setters:[
|
||||
function (_a_1) {
|
||||
exports_1("s", _a_1["s"]);
|
||||
exports_1("s2", _a_1["s1"]);
|
||||
}],
|
||||
execute: function() {
|
||||
exports_1("x", x);
|
||||
exports_1("z", z);
|
||||
exports_1("z2", z1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -25,26 +25,31 @@ export {y as z};
|
||||
System.register(['file1', 'file2', 'file3', 'file4', 'file5', 'file6', 'file7'], function(exports_1) {
|
||||
var ns, file2_1, file3_1, file5_1, ns3;
|
||||
var x, y;
|
||||
var exportedNames_1 = {
|
||||
'x': true,
|
||||
'z': true
|
||||
};
|
||||
return {
|
||||
setters:[
|
||||
function (_ns) {
|
||||
ns = _ns
|
||||
ns = _ns;
|
||||
},
|
||||
function (_file2_1) {
|
||||
file2_1 = _file2_1
|
||||
file2_1 = _file2_1;
|
||||
},
|
||||
function (_file3_1) {
|
||||
file3_1 = _file3_1
|
||||
file3_1 = _file3_1;
|
||||
},
|
||||
function (_) {},
|
||||
function (_file5_1) {
|
||||
file5_1 = _file5_1
|
||||
file5_1 = _file5_1;
|
||||
},
|
||||
function (_ns3) {
|
||||
ns3 = _ns3
|
||||
ns3 = _ns3;
|
||||
},
|
||||
function (_file7_1) {
|
||||
for (var n in _file7_1) exports_1(n, _file7_1[n]);
|
||||
for (var n in _file7_1)
|
||||
if (!exportedNames_1.hasOwnProperty(n)) exports_1(n, _file7_1[n]);
|
||||
}],
|
||||
execute: function() {
|
||||
ns.f();
|
||||
|
||||
@@ -1,7 +1,34 @@
|
||||
// @module: system
|
||||
// @separateCompilation: true
|
||||
|
||||
import 'foo'
|
||||
import {f} from 'bar';
|
||||
// set of tests cases that checks generation of local storage for exported names
|
||||
|
||||
f();
|
||||
// @filename: file1.ts
|
||||
|
||||
export var x;
|
||||
export function foo() {}
|
||||
export * from 'bar';
|
||||
|
||||
// @filename: file2.ts
|
||||
|
||||
var x;
|
||||
var y;
|
||||
export {x};
|
||||
export {y as y1}
|
||||
|
||||
export * from 'bar';
|
||||
|
||||
// @filename: file3.ts
|
||||
|
||||
export {x, y as z} from 'a';
|
||||
export * from 'bar';
|
||||
|
||||
// @filename: file4.ts
|
||||
|
||||
export var x;
|
||||
export function foo() {}
|
||||
|
||||
var z, z1;
|
||||
export {z, z1 as z2};
|
||||
|
||||
export {s, s1 as s2} from 'a'
|
||||
Reference in New Issue
Block a user