mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 15:45:27 -05:00
new tests
This commit is contained in:
@@ -6208,7 +6208,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
// do not emit var if variable was already hoisted
|
||||
|
||||
const isES6ExportedEnum = isES6ExportedDeclaration(node);
|
||||
if (!(node.flags & NodeFlags.Export) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, SyntaxKind.ModuleDeclaration))) {
|
||||
if ((!(node.flags & NodeFlags.Export)) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, SyntaxKind.EnumDeclaration))) {
|
||||
emitStart(node);
|
||||
if (isES6ExportedEnum) {
|
||||
write("export ");
|
||||
|
||||
23
tests/baselines/reference/enumExportMergingES6.js
Normal file
23
tests/baselines/reference/enumExportMergingES6.js
Normal file
@@ -0,0 +1,23 @@
|
||||
//// [enumExportMergingES6.ts]
|
||||
export enum Animals {
|
||||
Cat = 1
|
||||
}
|
||||
export enum Animals {
|
||||
Dog = 2
|
||||
}
|
||||
export enum Animals {
|
||||
CatDog = Cat | Dog
|
||||
}
|
||||
|
||||
|
||||
//// [enumExportMergingES6.js]
|
||||
export var Animals;
|
||||
(function (Animals) {
|
||||
Animals[Animals["Cat"] = 1] = "Cat";
|
||||
})(Animals || (Animals = {}));
|
||||
(function (Animals) {
|
||||
Animals[Animals["Dog"] = 2] = "Dog";
|
||||
})(Animals || (Animals = {}));
|
||||
(function (Animals) {
|
||||
Animals[Animals["CatDog"] = 3] = "CatDog";
|
||||
})(Animals || (Animals = {}));
|
||||
22
tests/baselines/reference/enumExportMergingES6.symbols
Normal file
22
tests/baselines/reference/enumExportMergingES6.symbols
Normal file
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/conformance/enums/enumExportMergingES6.ts ===
|
||||
export enum Animals {
|
||||
>Animals : Symbol(Animals, Decl(enumExportMergingES6.ts, 0, 0), Decl(enumExportMergingES6.ts, 2, 1), Decl(enumExportMergingES6.ts, 5, 1))
|
||||
|
||||
Cat = 1
|
||||
>Cat : Symbol(Animals.Cat, Decl(enumExportMergingES6.ts, 0, 21))
|
||||
}
|
||||
export enum Animals {
|
||||
>Animals : Symbol(Animals, Decl(enumExportMergingES6.ts, 0, 0), Decl(enumExportMergingES6.ts, 2, 1), Decl(enumExportMergingES6.ts, 5, 1))
|
||||
|
||||
Dog = 2
|
||||
>Dog : Symbol(Animals.Dog, Decl(enumExportMergingES6.ts, 3, 21))
|
||||
}
|
||||
export enum Animals {
|
||||
>Animals : Symbol(Animals, Decl(enumExportMergingES6.ts, 0, 0), Decl(enumExportMergingES6.ts, 2, 1), Decl(enumExportMergingES6.ts, 5, 1))
|
||||
|
||||
CatDog = Cat | Dog
|
||||
>CatDog : Symbol(Animals.CatDog, Decl(enumExportMergingES6.ts, 6, 21))
|
||||
>Cat : Symbol(Animals.Cat, Decl(enumExportMergingES6.ts, 0, 21))
|
||||
>Dog : Symbol(Animals.Dog, Decl(enumExportMergingES6.ts, 3, 21))
|
||||
}
|
||||
|
||||
25
tests/baselines/reference/enumExportMergingES6.types
Normal file
25
tests/baselines/reference/enumExportMergingES6.types
Normal file
@@ -0,0 +1,25 @@
|
||||
=== tests/cases/conformance/enums/enumExportMergingES6.ts ===
|
||||
export enum Animals {
|
||||
>Animals : Animals
|
||||
|
||||
Cat = 1
|
||||
>Cat : Animals
|
||||
>1 : number
|
||||
}
|
||||
export enum Animals {
|
||||
>Animals : Animals
|
||||
|
||||
Dog = 2
|
||||
>Dog : Animals
|
||||
>2 : number
|
||||
}
|
||||
export enum Animals {
|
||||
>Animals : Animals
|
||||
|
||||
CatDog = Cat | Dog
|
||||
>CatDog : Animals
|
||||
>Cat | Dog : number
|
||||
>Cat : Animals
|
||||
>Dog : Animals
|
||||
}
|
||||
|
||||
10
tests/cases/conformance/enums/enumExportMergingES6.ts
Normal file
10
tests/cases/conformance/enums/enumExportMergingES6.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
// @target: es6
|
||||
export enum Animals {
|
||||
Cat = 1
|
||||
}
|
||||
export enum Animals {
|
||||
Dog = 2
|
||||
}
|
||||
export enum Animals {
|
||||
CatDog = Cat | Dog
|
||||
}
|
||||
Reference in New Issue
Block a user