-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Component commits: acdaf36 Move class name capture for private state until after declaration evaluates Co-authored-by: Ron Buckton <rbuckton@microsoft.com>
- Loading branch information
Showing
4 changed files
with
92 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
tests/baselines/reference/privateNameComputedPropertyName4(target=es2015).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//// [privateNameComputedPropertyName4.ts] | ||
// https://github.com/microsoft/TypeScript/issues/44113 | ||
class C1 { | ||
static #qux = 42; | ||
["bar"] () {} | ||
} | ||
class C2 { | ||
static #qux = 42; | ||
static ["bar"] () {} | ||
} | ||
class C3 { | ||
static #qux = 42; | ||
static ["bar"] = "test"; | ||
} | ||
|
||
|
||
//// [privateNameComputedPropertyName4.js] | ||
var _a, _C1_qux, _b, _C2_qux, _c, _C3_qux; | ||
// https://github.com/microsoft/TypeScript/issues/44113 | ||
class C1 { | ||
["bar"]() { } | ||
} | ||
_a = C1; | ||
_C1_qux = { value: 42 }; | ||
class C2 { | ||
static ["bar"]() { } | ||
} | ||
_b = C2; | ||
_C2_qux = { value: 42 }; | ||
class C3 { | ||
} | ||
_c = C3; | ||
_C3_qux = { value: 42 }; | ||
Object.defineProperty(C3, "bar", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: "test" | ||
}); |
30 changes: 30 additions & 0 deletions
30
tests/baselines/reference/privateNameComputedPropertyName4(target=esnext).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//// [privateNameComputedPropertyName4.ts] | ||
// https://github.com/microsoft/TypeScript/issues/44113 | ||
class C1 { | ||
static #qux = 42; | ||
["bar"] () {} | ||
} | ||
class C2 { | ||
static #qux = 42; | ||
static ["bar"] () {} | ||
} | ||
class C3 { | ||
static #qux = 42; | ||
static ["bar"] = "test"; | ||
} | ||
|
||
|
||
//// [privateNameComputedPropertyName4.js] | ||
// https://github.com/microsoft/TypeScript/issues/44113 | ||
class C1 { | ||
static #qux = 42; | ||
["bar"]() { } | ||
} | ||
class C2 { | ||
static #qux = 42; | ||
static ["bar"]() { } | ||
} | ||
class C3 { | ||
static #qux = 42; | ||
static ["bar"] = "test"; | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/cases/conformance/classes/members/privateNames/privateNameComputedPropertyName4.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// @target: esnext, es2015 | ||
// @useDefineForClassFields: true | ||
// @noTypesAndSymbols: true | ||
// https://github.com/microsoft/TypeScript/issues/44113 | ||
class C1 { | ||
static #qux = 42; | ||
["bar"] () {} | ||
} | ||
class C2 { | ||
static #qux = 42; | ||
static ["bar"] () {} | ||
} | ||
class C3 { | ||
static #qux = 42; | ||
static ["bar"] = "test"; | ||
} |