mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
revert enum related changes
This commit is contained in:
@@ -13203,8 +13203,6 @@ namespace ts {
|
||||
let nodeLinks = getNodeLinks(node);
|
||||
|
||||
if (!(nodeLinks.flags & NodeCheckFlags.EnumValuesComputed)) {
|
||||
nodeLinks.flags |= NodeCheckFlags.EnumValuesComputed;
|
||||
|
||||
let enumSymbol = getSymbolOfNode(node);
|
||||
let enumType = getDeclaredTypeOfSymbol(enumSymbol);
|
||||
let autoValue = 0; // set to undefined when enum member is non-constant
|
||||
@@ -13242,6 +13240,8 @@ namespace ts {
|
||||
getNodeLinks(member).enumMemberValue = autoValue++;
|
||||
}
|
||||
}
|
||||
|
||||
nodeLinks.flags |= NodeCheckFlags.EnumValuesComputed;
|
||||
}
|
||||
|
||||
function computeConstantValueForEnumMemberInitializer(initializer: Expression, enumType: Type, enumIsConst: boolean, ambient: boolean): number {
|
||||
@@ -13387,7 +13387,6 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
computeEnumMemberValues(<EnumDeclaration>propertyDecl.parent);
|
||||
return <number>getNodeLinks(propertyDecl).enumMemberValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,9 @@ tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(2,13): error TS2448: Bl
|
||||
tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(58,20): error TS2448: Block-scoped variable 'x' used before its declaration.
|
||||
tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(65,20): error TS2448: Block-scoped variable 'x' used before its declaration.
|
||||
tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(100,12): error TS2448: Block-scoped variable 'x' used before its declaration.
|
||||
tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(105,20): error TS2651: A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.
|
||||
|
||||
|
||||
==== tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts (5 errors) ====
|
||||
==== tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts (4 errors) ====
|
||||
function foo0() {
|
||||
let a = x;
|
||||
~
|
||||
@@ -116,15 +115,4 @@ tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(105,20): error TS2651:
|
||||
!!! error TS2448: Block-scoped variable 'x' used before its declaration.
|
||||
}
|
||||
let x
|
||||
}
|
||||
|
||||
const enum A { X = B.Y }
|
||||
~~~
|
||||
!!! error TS2651: A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.
|
||||
|
||||
const enum B { Y }
|
||||
|
||||
function foo15() {
|
||||
const enum A1 { X = B1.Y }
|
||||
}
|
||||
const enum B1 { Y }
|
||||
}
|
||||
@@ -101,16 +101,7 @@ function foo14() {
|
||||
a: x
|
||||
}
|
||||
let x
|
||||
}
|
||||
|
||||
const enum A { X = B.Y }
|
||||
|
||||
const enum B { Y }
|
||||
|
||||
function foo15() {
|
||||
const enum A1 { X = B1.Y }
|
||||
}
|
||||
const enum B1 { Y }
|
||||
}
|
||||
|
||||
//// [blockScopedVariablesUseBeforeDef.js]
|
||||
function foo0() {
|
||||
@@ -223,5 +214,3 @@ function foo14() {
|
||||
};
|
||||
var x;
|
||||
}
|
||||
function foo15() {
|
||||
}
|
||||
|
||||
@@ -101,13 +101,4 @@ function foo14() {
|
||||
a: x
|
||||
}
|
||||
let x
|
||||
}
|
||||
|
||||
const enum A { X = B.Y }
|
||||
|
||||
const enum B { Y }
|
||||
|
||||
function foo15() {
|
||||
const enum A1 { X = B1.Y }
|
||||
}
|
||||
const enum B1 { Y }
|
||||
}
|
||||
Reference in New Issue
Block a user