mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-07-02 06:35:09 -05:00
Emit ES6 module enum declaration
Conflicts: src/compiler/emitter.ts
This commit is contained in:
@@ -4852,7 +4852,7 @@ module ts {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(node.flags & NodeFlags.Export)) {
|
||||
if (!(node.flags & NodeFlags.Export) || isES6ModuleMemberDeclaration(node)) {
|
||||
emitStart(node);
|
||||
write("var ");
|
||||
emit(node.name);
|
||||
@@ -4879,7 +4879,10 @@ module ts {
|
||||
emitModuleMemberName(node);
|
||||
write(" = {}));");
|
||||
emitEnd(node);
|
||||
if (node.flags & NodeFlags.Export) {
|
||||
if (isES6ModuleMemberDeclaration(node)) {
|
||||
emitES6NamedExportForDeclaration(node);
|
||||
}
|
||||
else if (node.flags & NodeFlags.Export) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
write("var ");
|
||||
@@ -4996,18 +4999,22 @@ module ts {
|
||||
write(" = {}));");
|
||||
emitEnd(node);
|
||||
if (isES6ModuleMemberDeclaration(node)) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
write("export { ");
|
||||
emit(node.name);
|
||||
write(" };");
|
||||
emitEnd(node);
|
||||
emitES6NamedExportForDeclaration(node);
|
||||
}
|
||||
else if (languageVersion < ScriptTarget.ES6 && node.name.kind === SyntaxKind.Identifier && node.parent === currentSourceFile) {
|
||||
emitExportMemberAssignments(<Identifier>node.name);
|
||||
}
|
||||
}
|
||||
|
||||
function emitES6NamedExportForDeclaration(node: Declaration) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
write("export { ");
|
||||
emit(node.name);
|
||||
write(" };");
|
||||
emitEnd(node);
|
||||
}
|
||||
|
||||
function emitRequire(moduleName: Expression) {
|
||||
if (moduleName.kind === SyntaxKind.StringLiteral) {
|
||||
write("require(");
|
||||
|
||||
66
tests/baselines/reference/es6ModuleConstEnumDeclaration.js
Normal file
66
tests/baselines/reference/es6ModuleConstEnumDeclaration.js
Normal file
@@ -0,0 +1,66 @@
|
||||
//// [es6ModuleConstEnumDeclaration.ts]
|
||||
export const enum e1 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
const enum e2 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x = e1.a;
|
||||
var y = e2.x;
|
||||
export module m1 {
|
||||
export const enum e3 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
const enum e4 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x1 = e1.a;
|
||||
var y1 = e2.x;
|
||||
var x2 = e3.a;
|
||||
var y2 = e4.x;
|
||||
}
|
||||
module m2 {
|
||||
export const enum e5 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
const enum e6 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x1 = e1.a;
|
||||
var y1 = e2.x;
|
||||
var x2 = e5.a;
|
||||
var y2 = e6.x;
|
||||
var x3 = m1.e3.a;
|
||||
}
|
||||
|
||||
//// [es6ModuleConstEnumDeclaration.js]
|
||||
var x = 0 /* a */;
|
||||
var y = 0 /* x */;
|
||||
var m1;
|
||||
(function (m1) {
|
||||
var x1 = 0 /* a */;
|
||||
var y1 = 0 /* x */;
|
||||
var x2 = 0 /* a */;
|
||||
var y2 = 0 /* x */;
|
||||
})(m1 || (m1 = {}));
|
||||
export { m1 };
|
||||
var m2;
|
||||
(function (m2) {
|
||||
var x1 = 0 /* a */;
|
||||
var y1 = 0 /* x */;
|
||||
var x2 = 0 /* a */;
|
||||
var y2 = 0 /* x */;
|
||||
var x3 = 0 /* a */;
|
||||
})(m2 || (m2 = {}));
|
||||
147
tests/baselines/reference/es6ModuleConstEnumDeclaration.types
Normal file
147
tests/baselines/reference/es6ModuleConstEnumDeclaration.types
Normal file
@@ -0,0 +1,147 @@
|
||||
=== tests/cases/compiler/es6ModuleConstEnumDeclaration.ts ===
|
||||
export const enum e1 {
|
||||
>e1 : e1
|
||||
|
||||
a,
|
||||
>a : e1
|
||||
|
||||
b,
|
||||
>b : e1
|
||||
|
||||
c
|
||||
>c : e1
|
||||
}
|
||||
const enum e2 {
|
||||
>e2 : e2
|
||||
|
||||
x,
|
||||
>x : e2
|
||||
|
||||
y,
|
||||
>y : e2
|
||||
|
||||
z
|
||||
>z : e2
|
||||
}
|
||||
var x = e1.a;
|
||||
>x : e1
|
||||
>e1.a : e1
|
||||
>e1 : typeof e1
|
||||
>a : e1
|
||||
|
||||
var y = e2.x;
|
||||
>y : e2
|
||||
>e2.x : e2
|
||||
>e2 : typeof e2
|
||||
>x : e2
|
||||
|
||||
export module m1 {
|
||||
>m1 : typeof m1
|
||||
|
||||
export const enum e3 {
|
||||
>e3 : e3
|
||||
|
||||
a,
|
||||
>a : e3
|
||||
|
||||
b,
|
||||
>b : e3
|
||||
|
||||
c
|
||||
>c : e3
|
||||
}
|
||||
const enum e4 {
|
||||
>e4 : e4
|
||||
|
||||
x,
|
||||
>x : e4
|
||||
|
||||
y,
|
||||
>y : e4
|
||||
|
||||
z
|
||||
>z : e4
|
||||
}
|
||||
var x1 = e1.a;
|
||||
>x1 : e1
|
||||
>e1.a : e1
|
||||
>e1 : typeof e1
|
||||
>a : e1
|
||||
|
||||
var y1 = e2.x;
|
||||
>y1 : e2
|
||||
>e2.x : e2
|
||||
>e2 : typeof e2
|
||||
>x : e2
|
||||
|
||||
var x2 = e3.a;
|
||||
>x2 : e3
|
||||
>e3.a : e3
|
||||
>e3 : typeof e3
|
||||
>a : e3
|
||||
|
||||
var y2 = e4.x;
|
||||
>y2 : e4
|
||||
>e4.x : e4
|
||||
>e4 : typeof e4
|
||||
>x : e4
|
||||
}
|
||||
module m2 {
|
||||
>m2 : typeof m2
|
||||
|
||||
export const enum e5 {
|
||||
>e5 : e5
|
||||
|
||||
a,
|
||||
>a : e5
|
||||
|
||||
b,
|
||||
>b : e5
|
||||
|
||||
c
|
||||
>c : e5
|
||||
}
|
||||
const enum e6 {
|
||||
>e6 : e6
|
||||
|
||||
x,
|
||||
>x : e6
|
||||
|
||||
y,
|
||||
>y : e6
|
||||
|
||||
z
|
||||
>z : e6
|
||||
}
|
||||
var x1 = e1.a;
|
||||
>x1 : e1
|
||||
>e1.a : e1
|
||||
>e1 : typeof e1
|
||||
>a : e1
|
||||
|
||||
var y1 = e2.x;
|
||||
>y1 : e2
|
||||
>e2.x : e2
|
||||
>e2 : typeof e2
|
||||
>x : e2
|
||||
|
||||
var x2 = e5.a;
|
||||
>x2 : e5
|
||||
>e5.a : e5
|
||||
>e5 : typeof e5
|
||||
>a : e5
|
||||
|
||||
var y2 = e6.x;
|
||||
>y2 : e6
|
||||
>e6.x : e6
|
||||
>e6 : typeof e6
|
||||
>x : e6
|
||||
|
||||
var x3 = m1.e3.a;
|
||||
>x3 : m1.e3
|
||||
>m1.e3.a : m1.e3
|
||||
>m1.e3 : typeof m1.e3
|
||||
>m1 : typeof m1
|
||||
>e3 : typeof m1.e3
|
||||
>a : m1.e3
|
||||
}
|
||||
104
tests/baselines/reference/es6ModuleConstEnumDeclaration2.js
Normal file
104
tests/baselines/reference/es6ModuleConstEnumDeclaration2.js
Normal file
@@ -0,0 +1,104 @@
|
||||
//// [es6ModuleConstEnumDeclaration2.ts]
|
||||
|
||||
export const enum e1 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
const enum e2 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x = e1.a;
|
||||
var y = e2.x;
|
||||
export module m1 {
|
||||
export const enum e3 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
const enum e4 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x1 = e1.a;
|
||||
var y1 = e2.x;
|
||||
var x2 = e3.a;
|
||||
var y2 = e4.x;
|
||||
}
|
||||
module m2 {
|
||||
export const enum e5 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
const enum e6 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x1 = e1.a;
|
||||
var y1 = e2.x;
|
||||
var x2 = e5.a;
|
||||
var y2 = e6.x;
|
||||
var x3 = m1.e3.a;
|
||||
}
|
||||
|
||||
//// [es6ModuleConstEnumDeclaration2.js]
|
||||
var e1;
|
||||
(function (e1) {
|
||||
e1[e1["a"] = 0] = "a";
|
||||
e1[e1["b"] = 1] = "b";
|
||||
e1[e1["c"] = 2] = "c";
|
||||
})(e1 || (e1 = {}));
|
||||
export { e1 };
|
||||
var e2;
|
||||
(function (e2) {
|
||||
e2[e2["x"] = 0] = "x";
|
||||
e2[e2["y"] = 1] = "y";
|
||||
e2[e2["z"] = 2] = "z";
|
||||
})(e2 || (e2 = {}));
|
||||
var x = 0 /* a */;
|
||||
var y = 0 /* x */;
|
||||
var m1;
|
||||
(function (m1) {
|
||||
(function (e3) {
|
||||
e3[e3["a"] = 0] = "a";
|
||||
e3[e3["b"] = 1] = "b";
|
||||
e3[e3["c"] = 2] = "c";
|
||||
})(m1.e3 || (m1.e3 = {}));
|
||||
var e3 = m1.e3;
|
||||
var e4;
|
||||
(function (e4) {
|
||||
e4[e4["x"] = 0] = "x";
|
||||
e4[e4["y"] = 1] = "y";
|
||||
e4[e4["z"] = 2] = "z";
|
||||
})(e4 || (e4 = {}));
|
||||
var x1 = 0 /* a */;
|
||||
var y1 = 0 /* x */;
|
||||
var x2 = 0 /* a */;
|
||||
var y2 = 0 /* x */;
|
||||
})(m1 || (m1 = {}));
|
||||
export { m1 };
|
||||
var m2;
|
||||
(function (m2) {
|
||||
(function (e5) {
|
||||
e5[e5["a"] = 0] = "a";
|
||||
e5[e5["b"] = 1] = "b";
|
||||
e5[e5["c"] = 2] = "c";
|
||||
})(m2.e5 || (m2.e5 = {}));
|
||||
var e5 = m2.e5;
|
||||
var e6;
|
||||
(function (e6) {
|
||||
e6[e6["x"] = 0] = "x";
|
||||
e6[e6["y"] = 1] = "y";
|
||||
e6[e6["z"] = 2] = "z";
|
||||
})(e6 || (e6 = {}));
|
||||
var x1 = 0 /* a */;
|
||||
var y1 = 0 /* x */;
|
||||
var x2 = 0 /* a */;
|
||||
var y2 = 0 /* x */;
|
||||
var x3 = 0 /* a */;
|
||||
})(m2 || (m2 = {}));
|
||||
148
tests/baselines/reference/es6ModuleConstEnumDeclaration2.types
Normal file
148
tests/baselines/reference/es6ModuleConstEnumDeclaration2.types
Normal file
@@ -0,0 +1,148 @@
|
||||
=== tests/cases/compiler/es6ModuleConstEnumDeclaration2.ts ===
|
||||
|
||||
export const enum e1 {
|
||||
>e1 : e1
|
||||
|
||||
a,
|
||||
>a : e1
|
||||
|
||||
b,
|
||||
>b : e1
|
||||
|
||||
c
|
||||
>c : e1
|
||||
}
|
||||
const enum e2 {
|
||||
>e2 : e2
|
||||
|
||||
x,
|
||||
>x : e2
|
||||
|
||||
y,
|
||||
>y : e2
|
||||
|
||||
z
|
||||
>z : e2
|
||||
}
|
||||
var x = e1.a;
|
||||
>x : e1
|
||||
>e1.a : e1
|
||||
>e1 : typeof e1
|
||||
>a : e1
|
||||
|
||||
var y = e2.x;
|
||||
>y : e2
|
||||
>e2.x : e2
|
||||
>e2 : typeof e2
|
||||
>x : e2
|
||||
|
||||
export module m1 {
|
||||
>m1 : typeof m1
|
||||
|
||||
export const enum e3 {
|
||||
>e3 : e3
|
||||
|
||||
a,
|
||||
>a : e3
|
||||
|
||||
b,
|
||||
>b : e3
|
||||
|
||||
c
|
||||
>c : e3
|
||||
}
|
||||
const enum e4 {
|
||||
>e4 : e4
|
||||
|
||||
x,
|
||||
>x : e4
|
||||
|
||||
y,
|
||||
>y : e4
|
||||
|
||||
z
|
||||
>z : e4
|
||||
}
|
||||
var x1 = e1.a;
|
||||
>x1 : e1
|
||||
>e1.a : e1
|
||||
>e1 : typeof e1
|
||||
>a : e1
|
||||
|
||||
var y1 = e2.x;
|
||||
>y1 : e2
|
||||
>e2.x : e2
|
||||
>e2 : typeof e2
|
||||
>x : e2
|
||||
|
||||
var x2 = e3.a;
|
||||
>x2 : e3
|
||||
>e3.a : e3
|
||||
>e3 : typeof e3
|
||||
>a : e3
|
||||
|
||||
var y2 = e4.x;
|
||||
>y2 : e4
|
||||
>e4.x : e4
|
||||
>e4 : typeof e4
|
||||
>x : e4
|
||||
}
|
||||
module m2 {
|
||||
>m2 : typeof m2
|
||||
|
||||
export const enum e5 {
|
||||
>e5 : e5
|
||||
|
||||
a,
|
||||
>a : e5
|
||||
|
||||
b,
|
||||
>b : e5
|
||||
|
||||
c
|
||||
>c : e5
|
||||
}
|
||||
const enum e6 {
|
||||
>e6 : e6
|
||||
|
||||
x,
|
||||
>x : e6
|
||||
|
||||
y,
|
||||
>y : e6
|
||||
|
||||
z
|
||||
>z : e6
|
||||
}
|
||||
var x1 = e1.a;
|
||||
>x1 : e1
|
||||
>e1.a : e1
|
||||
>e1 : typeof e1
|
||||
>a : e1
|
||||
|
||||
var y1 = e2.x;
|
||||
>y1 : e2
|
||||
>e2.x : e2
|
||||
>e2 : typeof e2
|
||||
>x : e2
|
||||
|
||||
var x2 = e5.a;
|
||||
>x2 : e5
|
||||
>e5.a : e5
|
||||
>e5 : typeof e5
|
||||
>a : e5
|
||||
|
||||
var y2 = e6.x;
|
||||
>y2 : e6
|
||||
>e6.x : e6
|
||||
>e6 : typeof e6
|
||||
>x : e6
|
||||
|
||||
var x3 = m1.e3.a;
|
||||
>x3 : m1.e3
|
||||
>m1.e3.a : m1.e3
|
||||
>m1.e3 : typeof m1.e3
|
||||
>m1 : typeof m1
|
||||
>e3 : typeof m1.e3
|
||||
>a : m1.e3
|
||||
}
|
||||
103
tests/baselines/reference/es6ModuleEnumDeclaration.js
Normal file
103
tests/baselines/reference/es6ModuleEnumDeclaration.js
Normal file
@@ -0,0 +1,103 @@
|
||||
//// [es6ModuleEnumDeclaration.ts]
|
||||
export enum e1 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
enum e2 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x = e1.a;
|
||||
var y = e2.x;
|
||||
export module m1 {
|
||||
export enum e3 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
enum e4 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x1 = e1.a;
|
||||
var y1 = e2.x;
|
||||
var x2 = e3.a;
|
||||
var y2 = e4.x;
|
||||
}
|
||||
module m2 {
|
||||
export enum e5 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
enum e6 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x1 = e1.a;
|
||||
var y1 = e2.x;
|
||||
var x2 = e5.a;
|
||||
var y2 = e6.x;
|
||||
var x3 = m1.e3.a;
|
||||
}
|
||||
|
||||
//// [es6ModuleEnumDeclaration.js]
|
||||
var e1;
|
||||
(function (e1) {
|
||||
e1[e1["a"] = 0] = "a";
|
||||
e1[e1["b"] = 1] = "b";
|
||||
e1[e1["c"] = 2] = "c";
|
||||
})(e1 || (e1 = {}));
|
||||
export { e1 };
|
||||
var e2;
|
||||
(function (e2) {
|
||||
e2[e2["x"] = 0] = "x";
|
||||
e2[e2["y"] = 1] = "y";
|
||||
e2[e2["z"] = 2] = "z";
|
||||
})(e2 || (e2 = {}));
|
||||
var x = 0 /* a */;
|
||||
var y = 0 /* x */;
|
||||
var m1;
|
||||
(function (m1) {
|
||||
(function (e3) {
|
||||
e3[e3["a"] = 0] = "a";
|
||||
e3[e3["b"] = 1] = "b";
|
||||
e3[e3["c"] = 2] = "c";
|
||||
})(m1.e3 || (m1.e3 = {}));
|
||||
var e3 = m1.e3;
|
||||
var e4;
|
||||
(function (e4) {
|
||||
e4[e4["x"] = 0] = "x";
|
||||
e4[e4["y"] = 1] = "y";
|
||||
e4[e4["z"] = 2] = "z";
|
||||
})(e4 || (e4 = {}));
|
||||
var x1 = 0 /* a */;
|
||||
var y1 = 0 /* x */;
|
||||
var x2 = 0 /* a */;
|
||||
var y2 = 0 /* x */;
|
||||
})(m1 || (m1 = {}));
|
||||
export { m1 };
|
||||
var m2;
|
||||
(function (m2) {
|
||||
(function (e5) {
|
||||
e5[e5["a"] = 0] = "a";
|
||||
e5[e5["b"] = 1] = "b";
|
||||
e5[e5["c"] = 2] = "c";
|
||||
})(m2.e5 || (m2.e5 = {}));
|
||||
var e5 = m2.e5;
|
||||
var e6;
|
||||
(function (e6) {
|
||||
e6[e6["x"] = 0] = "x";
|
||||
e6[e6["y"] = 1] = "y";
|
||||
e6[e6["z"] = 2] = "z";
|
||||
})(e6 || (e6 = {}));
|
||||
var x1 = 0 /* a */;
|
||||
var y1 = 0 /* x */;
|
||||
var x2 = 0 /* a */;
|
||||
var y2 = 0 /* x */;
|
||||
var x3 = 0 /* a */;
|
||||
})(m2 || (m2 = {}));
|
||||
147
tests/baselines/reference/es6ModuleEnumDeclaration.types
Normal file
147
tests/baselines/reference/es6ModuleEnumDeclaration.types
Normal file
@@ -0,0 +1,147 @@
|
||||
=== tests/cases/compiler/es6ModuleEnumDeclaration.ts ===
|
||||
export enum e1 {
|
||||
>e1 : e1
|
||||
|
||||
a,
|
||||
>a : e1
|
||||
|
||||
b,
|
||||
>b : e1
|
||||
|
||||
c
|
||||
>c : e1
|
||||
}
|
||||
enum e2 {
|
||||
>e2 : e2
|
||||
|
||||
x,
|
||||
>x : e2
|
||||
|
||||
y,
|
||||
>y : e2
|
||||
|
||||
z
|
||||
>z : e2
|
||||
}
|
||||
var x = e1.a;
|
||||
>x : e1
|
||||
>e1.a : e1
|
||||
>e1 : typeof e1
|
||||
>a : e1
|
||||
|
||||
var y = e2.x;
|
||||
>y : e2
|
||||
>e2.x : e2
|
||||
>e2 : typeof e2
|
||||
>x : e2
|
||||
|
||||
export module m1 {
|
||||
>m1 : typeof m1
|
||||
|
||||
export enum e3 {
|
||||
>e3 : e3
|
||||
|
||||
a,
|
||||
>a : e3
|
||||
|
||||
b,
|
||||
>b : e3
|
||||
|
||||
c
|
||||
>c : e3
|
||||
}
|
||||
enum e4 {
|
||||
>e4 : e4
|
||||
|
||||
x,
|
||||
>x : e4
|
||||
|
||||
y,
|
||||
>y : e4
|
||||
|
||||
z
|
||||
>z : e4
|
||||
}
|
||||
var x1 = e1.a;
|
||||
>x1 : e1
|
||||
>e1.a : e1
|
||||
>e1 : typeof e1
|
||||
>a : e1
|
||||
|
||||
var y1 = e2.x;
|
||||
>y1 : e2
|
||||
>e2.x : e2
|
||||
>e2 : typeof e2
|
||||
>x : e2
|
||||
|
||||
var x2 = e3.a;
|
||||
>x2 : e3
|
||||
>e3.a : e3
|
||||
>e3 : typeof e3
|
||||
>a : e3
|
||||
|
||||
var y2 = e4.x;
|
||||
>y2 : e4
|
||||
>e4.x : e4
|
||||
>e4 : typeof e4
|
||||
>x : e4
|
||||
}
|
||||
module m2 {
|
||||
>m2 : typeof m2
|
||||
|
||||
export enum e5 {
|
||||
>e5 : e5
|
||||
|
||||
a,
|
||||
>a : e5
|
||||
|
||||
b,
|
||||
>b : e5
|
||||
|
||||
c
|
||||
>c : e5
|
||||
}
|
||||
enum e6 {
|
||||
>e6 : e6
|
||||
|
||||
x,
|
||||
>x : e6
|
||||
|
||||
y,
|
||||
>y : e6
|
||||
|
||||
z
|
||||
>z : e6
|
||||
}
|
||||
var x1 = e1.a;
|
||||
>x1 : e1
|
||||
>e1.a : e1
|
||||
>e1 : typeof e1
|
||||
>a : e1
|
||||
|
||||
var y1 = e2.x;
|
||||
>y1 : e2
|
||||
>e2.x : e2
|
||||
>e2 : typeof e2
|
||||
>x : e2
|
||||
|
||||
var x2 = e5.a;
|
||||
>x2 : e5
|
||||
>e5.a : e5
|
||||
>e5 : typeof e5
|
||||
>a : e5
|
||||
|
||||
var y2 = e6.x;
|
||||
>y2 : e6
|
||||
>e6.x : e6
|
||||
>e6 : typeof e6
|
||||
>x : e6
|
||||
|
||||
var x3 = m1.e3.a;
|
||||
>x3 : m1.e3
|
||||
>m1.e3.a : m1.e3
|
||||
>m1.e3 : typeof m1.e3
|
||||
>m1 : typeof m1
|
||||
>e3 : typeof m1.e3
|
||||
>a : m1.e3
|
||||
}
|
||||
46
tests/cases/compiler/es6ModuleConstEnumDeclaration.ts
Normal file
46
tests/cases/compiler/es6ModuleConstEnumDeclaration.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
// @target: ES6
|
||||
export const enum e1 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
const enum e2 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x = e1.a;
|
||||
var y = e2.x;
|
||||
export module m1 {
|
||||
export const enum e3 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
const enum e4 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x1 = e1.a;
|
||||
var y1 = e2.x;
|
||||
var x2 = e3.a;
|
||||
var y2 = e4.x;
|
||||
}
|
||||
module m2 {
|
||||
export const enum e5 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
const enum e6 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x1 = e1.a;
|
||||
var y1 = e2.x;
|
||||
var x2 = e5.a;
|
||||
var y2 = e6.x;
|
||||
var x3 = m1.e3.a;
|
||||
}
|
||||
48
tests/cases/compiler/es6ModuleConstEnumDeclaration2.ts
Normal file
48
tests/cases/compiler/es6ModuleConstEnumDeclaration2.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
// @target: ES6
|
||||
// @preserveConstEnums: true
|
||||
|
||||
export const enum e1 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
const enum e2 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x = e1.a;
|
||||
var y = e2.x;
|
||||
export module m1 {
|
||||
export const enum e3 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
const enum e4 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x1 = e1.a;
|
||||
var y1 = e2.x;
|
||||
var x2 = e3.a;
|
||||
var y2 = e4.x;
|
||||
}
|
||||
module m2 {
|
||||
export const enum e5 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
const enum e6 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x1 = e1.a;
|
||||
var y1 = e2.x;
|
||||
var x2 = e5.a;
|
||||
var y2 = e6.x;
|
||||
var x3 = m1.e3.a;
|
||||
}
|
||||
46
tests/cases/compiler/es6ModuleEnumDeclaration.ts
Normal file
46
tests/cases/compiler/es6ModuleEnumDeclaration.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
// @target: ES6
|
||||
export enum e1 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
enum e2 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x = e1.a;
|
||||
var y = e2.x;
|
||||
export module m1 {
|
||||
export enum e3 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
enum e4 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x1 = e1.a;
|
||||
var y1 = e2.x;
|
||||
var x2 = e3.a;
|
||||
var y2 = e4.x;
|
||||
}
|
||||
module m2 {
|
||||
export enum e5 {
|
||||
a,
|
||||
b,
|
||||
c
|
||||
}
|
||||
enum e6 {
|
||||
x,
|
||||
y,
|
||||
z
|
||||
}
|
||||
var x1 = e1.a;
|
||||
var y1 = e2.x;
|
||||
var x2 = e5.a;
|
||||
var y2 = e6.x;
|
||||
var x3 = m1.e3.a;
|
||||
}
|
||||
Reference in New Issue
Block a user