Improve escape sequence handling in private names (#50856)

* Add tests for identifiers and private identifiers with escape sequences.

* Accepted baselines.

* Store the tokenValue instead of tokenText on PrivateIdentifiers, since the latter can contain escapes and lead to semantic discrepancies.

* Accepted baselines.

* Check for leading escape sequences in PrivateIdentifiers.

* Accepted baselines.

* Fix lints.
This commit is contained in:
Daniel Rosenwasser 2022-09-20 15:00:39 -07:00 committed by GitHub
parent 938a69a526
commit d90795e799
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1761 additions and 4 deletions

View File

@ -2281,7 +2281,7 @@ namespace ts {
function parsePrivateIdentifier(): PrivateIdentifier {
const pos = getNodePos();
const node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText()));
const node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue()));
nextToken();
return finishNode(node, pos);
}

View File

@ -2052,12 +2052,38 @@ namespace ts {
return token = SyntaxKind.Unknown;
}
if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) {
const charAfterHash = codePointAt(text, pos + 1);
if (charAfterHash === CharacterCodes.backslash) {
pos++;
scanIdentifier(codePointAt(text, pos), languageVersion);
const extendedCookedChar = peekExtendedUnicodeEscape();
if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) {
pos += 3;
tokenFlags |= TokenFlags.ExtendedUnicodeEscape;
tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts();
return token = SyntaxKind.PrivateIdentifier;
}
const cookedChar = peekUnicodeEscape();
if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) {
pos += 6;
tokenFlags |= TokenFlags.UnicodeEscape;
tokenValue = "#" + String.fromCharCode(cookedChar) + scanIdentifierParts();
return token = SyntaxKind.PrivateIdentifier;
}
pos--;
}
if (isIdentifierStart(charAfterHash, languageVersion)) {
pos++;
// We're relying on scanIdentifier's behavior and adjusting the token kind after the fact.
// Notably absent from this block is the fact that calling a function named "scanIdentifier",
// but identifiers don't include '#', and that function doesn't deal with it at all.
// This works because 'scanIdentifier' tries to reuse source characters and builds up substrings;
// however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us.
scanIdentifier(charAfterHash, languageVersion);
}
else {
tokenValue = String.fromCharCode(codePointAt(text, pos));
tokenValue = "#";
error(Diagnostics.Invalid_character, pos++, charSize(ch));
}
return token = SyntaxKind.PrivateIdentifier;

View File

@ -0,0 +1,215 @@
//// [tests/cases/conformance/classes/members/privateNames/privateNamesEscapeSequences01.ts] ////
//// [IdentifierNameWithEscape1.ts]
export class IdentifierNameWithEscape1 {
\u0078: number;
constructor() {
this.\u0078 = 0;
}
doThing() {
this.x = 42;
}
}
//// [IdentifierNameWithEscape2.ts]
export class IdentifierNameWithEscape2 {
x\u0078: number;
constructor() {
this.x\u0078 = 0;
}
doThing() {
this.xx = 42;
}
}
//// [IdentifierNameWithExtendedEscape1.ts]
export class IdentifierNameWithExtendedEscape1 {
\u{78}: number;
constructor() {
this.\u{78} = 0;
}
doThing() {
this.x = 42;
}
}
//// [IdentifierNameWithExtendedEscape2.ts]
export class IdentifierNameWithExtendedEscape2 {
x\u{78}: number;
constructor() {
this.x\u{78} = 0;
}
doThing() {
this.xx = 42;
}
}
//// [PrivateIdentifierNameWithEscape1.ts]
export class PrivateIdentifierWithEscape1 {
#\u0078: number;
constructor() {
this.#\u0078 = 0;
}
doThing() {
this.#x = 42;
}
}
//// [PrivateIdentifierNameWithEscape2.ts]
export class PrivateIdentifierWithEscape2 {
#x\u0078: number;
constructor() {
this.#x\u0078 = 0;
}
doThing() {
this.#xx = 42;
}
}
//// [PrivateIdentifierNameWithExtendedEscape1.ts]
export class PrivateIdentifierWithExtendedEscape1 {
#\u{78}: number;
constructor() {
this.#\u{78} = 0;
}
doThing() {
this.#x = 42;
}
}
//// [PrivateIdentifierNameWithExtendedEscape2.ts]
export class PrivateIdentifierWithExtendedEscape2 {
#x\u{78}: number;
constructor() {
this.#x\u{78} = 0;
}
doThing() {
this.#xx = 42;
}
}
//// [IdentifierNameWithEscape1.js]
export class IdentifierNameWithEscape1 {
constructor() {
this.\u0078 = 0;
}
doThing() {
this.x = 42;
}
}
//// [IdentifierNameWithEscape2.js]
export class IdentifierNameWithEscape2 {
constructor() {
this.x\u0078 = 0;
}
doThing() {
this.xx = 42;
}
}
//// [IdentifierNameWithExtendedEscape1.js]
export class IdentifierNameWithExtendedEscape1 {
constructor() {
this.\u{78} = 0;
}
doThing() {
this.x = 42;
}
}
//// [IdentifierNameWithExtendedEscape2.js]
export class IdentifierNameWithExtendedEscape2 {
constructor() {
this.x\u{78} = 0;
}
doThing() {
this.xx = 42;
}
}
//// [PrivateIdentifierNameWithEscape1.js]
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _PrivateIdentifierWithEscape1_x;
export class PrivateIdentifierWithEscape1 {
constructor() {
_PrivateIdentifierWithEscape1_x.set(this, void 0);
__classPrivateFieldSet(this, _PrivateIdentifierWithEscape1_x, 0, "f");
}
doThing() {
__classPrivateFieldSet(this, _PrivateIdentifierWithEscape1_x, 42, "f");
}
}
_PrivateIdentifierWithEscape1_x = new WeakMap();
//// [PrivateIdentifierNameWithEscape2.js]
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _PrivateIdentifierWithEscape2_xx;
export class PrivateIdentifierWithEscape2 {
constructor() {
_PrivateIdentifierWithEscape2_xx.set(this, void 0);
__classPrivateFieldSet(this, _PrivateIdentifierWithEscape2_xx, 0, "f");
}
doThing() {
__classPrivateFieldSet(this, _PrivateIdentifierWithEscape2_xx, 42, "f");
}
}
_PrivateIdentifierWithEscape2_xx = new WeakMap();
//// [PrivateIdentifierNameWithExtendedEscape1.js]
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _PrivateIdentifierWithExtendedEscape1_x;
export class PrivateIdentifierWithExtendedEscape1 {
constructor() {
_PrivateIdentifierWithExtendedEscape1_x.set(this, void 0);
__classPrivateFieldSet(this, _PrivateIdentifierWithExtendedEscape1_x, 0, "f");
}
doThing() {
__classPrivateFieldSet(this, _PrivateIdentifierWithExtendedEscape1_x, 42, "f");
}
}
_PrivateIdentifierWithExtendedEscape1_x = new WeakMap();
//// [PrivateIdentifierNameWithExtendedEscape2.js]
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _PrivateIdentifierWithExtendedEscape2_xx;
export class PrivateIdentifierWithExtendedEscape2 {
constructor() {
_PrivateIdentifierWithExtendedEscape2_xx.set(this, void 0);
__classPrivateFieldSet(this, _PrivateIdentifierWithExtendedEscape2_xx, 0, "f");
}
doThing() {
__classPrivateFieldSet(this, _PrivateIdentifierWithExtendedEscape2_xx, 42, "f");
}
}
_PrivateIdentifierWithExtendedEscape2_xx = new WeakMap();

View File

@ -0,0 +1,184 @@
=== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithEscape1.ts ===
export class IdentifierNameWithEscape1 {
>IdentifierNameWithEscape1 : Symbol(IdentifierNameWithEscape1, Decl(IdentifierNameWithEscape1.ts, 0, 0))
\u0078: number;
>\u0078 : Symbol(IdentifierNameWithEscape1[\u0078], Decl(IdentifierNameWithEscape1.ts, 0, 40))
constructor() {
this.\u0078 = 0;
>this.\u0078 : Symbol(IdentifierNameWithEscape1[\u0078], Decl(IdentifierNameWithEscape1.ts, 0, 40))
>this : Symbol(IdentifierNameWithEscape1, Decl(IdentifierNameWithEscape1.ts, 0, 0))
>\u0078 : Symbol(IdentifierNameWithEscape1[\u0078], Decl(IdentifierNameWithEscape1.ts, 0, 40))
}
doThing() {
>doThing : Symbol(IdentifierNameWithEscape1.doThing, Decl(IdentifierNameWithEscape1.ts, 5, 5))
this.x = 42;
>this.x : Symbol(IdentifierNameWithEscape1[\u0078], Decl(IdentifierNameWithEscape1.ts, 0, 40))
>this : Symbol(IdentifierNameWithEscape1, Decl(IdentifierNameWithEscape1.ts, 0, 0))
>x : Symbol(IdentifierNameWithEscape1[\u0078], Decl(IdentifierNameWithEscape1.ts, 0, 40))
}
}
=== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithEscape2.ts ===
export class IdentifierNameWithEscape2 {
>IdentifierNameWithEscape2 : Symbol(IdentifierNameWithEscape2, Decl(IdentifierNameWithEscape2.ts, 0, 0))
x\u0078: number;
>x\u0078 : Symbol(IdentifierNameWithEscape2.x\u0078, Decl(IdentifierNameWithEscape2.ts, 0, 40))
constructor() {
this.x\u0078 = 0;
>this.x\u0078 : Symbol(IdentifierNameWithEscape2.x\u0078, Decl(IdentifierNameWithEscape2.ts, 0, 40))
>this : Symbol(IdentifierNameWithEscape2, Decl(IdentifierNameWithEscape2.ts, 0, 0))
>x\u0078 : Symbol(IdentifierNameWithEscape2.x\u0078, Decl(IdentifierNameWithEscape2.ts, 0, 40))
}
doThing() {
>doThing : Symbol(IdentifierNameWithEscape2.doThing, Decl(IdentifierNameWithEscape2.ts, 5, 5))
this.xx = 42;
>this.xx : Symbol(IdentifierNameWithEscape2.x\u0078, Decl(IdentifierNameWithEscape2.ts, 0, 40))
>this : Symbol(IdentifierNameWithEscape2, Decl(IdentifierNameWithEscape2.ts, 0, 0))
>xx : Symbol(IdentifierNameWithEscape2.x\u0078, Decl(IdentifierNameWithEscape2.ts, 0, 40))
}
}
=== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts ===
export class IdentifierNameWithExtendedEscape1 {
>IdentifierNameWithExtendedEscape1 : Symbol(IdentifierNameWithExtendedEscape1, Decl(IdentifierNameWithExtendedEscape1.ts, 0, 0))
\u{78}: number;
>\u{78} : Symbol(IdentifierNameWithExtendedEscape1[\u{78}], Decl(IdentifierNameWithExtendedEscape1.ts, 0, 48))
constructor() {
this.\u{78} = 0;
>this.\u{78} : Symbol(IdentifierNameWithExtendedEscape1[\u{78}], Decl(IdentifierNameWithExtendedEscape1.ts, 0, 48))
>this : Symbol(IdentifierNameWithExtendedEscape1, Decl(IdentifierNameWithExtendedEscape1.ts, 0, 0))
>\u{78} : Symbol(IdentifierNameWithExtendedEscape1[\u{78}], Decl(IdentifierNameWithExtendedEscape1.ts, 0, 48))
}
doThing() {
>doThing : Symbol(IdentifierNameWithExtendedEscape1.doThing, Decl(IdentifierNameWithExtendedEscape1.ts, 5, 5))
this.x = 42;
>this.x : Symbol(IdentifierNameWithExtendedEscape1[\u{78}], Decl(IdentifierNameWithExtendedEscape1.ts, 0, 48))
>this : Symbol(IdentifierNameWithExtendedEscape1, Decl(IdentifierNameWithExtendedEscape1.ts, 0, 0))
>x : Symbol(IdentifierNameWithExtendedEscape1[\u{78}], Decl(IdentifierNameWithExtendedEscape1.ts, 0, 48))
}
}
=== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts ===
export class IdentifierNameWithExtendedEscape2 {
>IdentifierNameWithExtendedEscape2 : Symbol(IdentifierNameWithExtendedEscape2, Decl(IdentifierNameWithExtendedEscape2.ts, 0, 0))
x\u{78}: number;
>x\u{78} : Symbol(IdentifierNameWithExtendedEscape2.x\u{78}, Decl(IdentifierNameWithExtendedEscape2.ts, 0, 48))
constructor() {
this.x\u{78} = 0;
>this.x\u{78} : Symbol(IdentifierNameWithExtendedEscape2.x\u{78}, Decl(IdentifierNameWithExtendedEscape2.ts, 0, 48))
>this : Symbol(IdentifierNameWithExtendedEscape2, Decl(IdentifierNameWithExtendedEscape2.ts, 0, 0))
>x\u{78} : Symbol(IdentifierNameWithExtendedEscape2.x\u{78}, Decl(IdentifierNameWithExtendedEscape2.ts, 0, 48))
}
doThing() {
>doThing : Symbol(IdentifierNameWithExtendedEscape2.doThing, Decl(IdentifierNameWithExtendedEscape2.ts, 5, 5))
this.xx = 42;
>this.xx : Symbol(IdentifierNameWithExtendedEscape2.x\u{78}, Decl(IdentifierNameWithExtendedEscape2.ts, 0, 48))
>this : Symbol(IdentifierNameWithExtendedEscape2, Decl(IdentifierNameWithExtendedEscape2.ts, 0, 0))
>xx : Symbol(IdentifierNameWithExtendedEscape2.x\u{78}, Decl(IdentifierNameWithExtendedEscape2.ts, 0, 48))
}
}
=== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithEscape1.ts ===
export class PrivateIdentifierWithEscape1 {
>PrivateIdentifierWithEscape1 : Symbol(PrivateIdentifierWithEscape1, Decl(PrivateIdentifierNameWithEscape1.ts, 0, 0))
#\u0078: number;
>#\u0078 : Symbol(PrivateIdentifierWithEscape1[#\u0078], Decl(PrivateIdentifierNameWithEscape1.ts, 0, 43))
constructor() {
this.#\u0078 = 0;
>this.#\u0078 : Symbol(PrivateIdentifierWithEscape1[#\u0078], Decl(PrivateIdentifierNameWithEscape1.ts, 0, 43))
>this : Symbol(PrivateIdentifierWithEscape1, Decl(PrivateIdentifierNameWithEscape1.ts, 0, 0))
}
doThing() {
>doThing : Symbol(PrivateIdentifierWithEscape1.doThing, Decl(PrivateIdentifierNameWithEscape1.ts, 5, 5))
this.#x = 42;
>this.#x : Symbol(PrivateIdentifierWithEscape1[#\u0078], Decl(PrivateIdentifierNameWithEscape1.ts, 0, 43))
>this : Symbol(PrivateIdentifierWithEscape1, Decl(PrivateIdentifierNameWithEscape1.ts, 0, 0))
}
}
=== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithEscape2.ts ===
export class PrivateIdentifierWithEscape2 {
>PrivateIdentifierWithEscape2 : Symbol(PrivateIdentifierWithEscape2, Decl(PrivateIdentifierNameWithEscape2.ts, 0, 0))
#x\u0078: number;
>#x\u0078 : Symbol(PrivateIdentifierWithEscape2.#x\u0078, Decl(PrivateIdentifierNameWithEscape2.ts, 0, 43))
constructor() {
this.#x\u0078 = 0;
>this.#x\u0078 : Symbol(PrivateIdentifierWithEscape2.#x\u0078, Decl(PrivateIdentifierNameWithEscape2.ts, 0, 43))
>this : Symbol(PrivateIdentifierWithEscape2, Decl(PrivateIdentifierNameWithEscape2.ts, 0, 0))
}
doThing() {
>doThing : Symbol(PrivateIdentifierWithEscape2.doThing, Decl(PrivateIdentifierNameWithEscape2.ts, 5, 5))
this.#xx = 42;
>this.#xx : Symbol(PrivateIdentifierWithEscape2.#x\u0078, Decl(PrivateIdentifierNameWithEscape2.ts, 0, 43))
>this : Symbol(PrivateIdentifierWithEscape2, Decl(PrivateIdentifierNameWithEscape2.ts, 0, 0))
}
}
=== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts ===
export class PrivateIdentifierWithExtendedEscape1 {
>PrivateIdentifierWithExtendedEscape1 : Symbol(PrivateIdentifierWithExtendedEscape1, Decl(PrivateIdentifierNameWithExtendedEscape1.ts, 0, 0))
#\u{78}: number;
>#\u{78} : Symbol(PrivateIdentifierWithExtendedEscape1[#\u{78}], Decl(PrivateIdentifierNameWithExtendedEscape1.ts, 0, 51))
constructor() {
this.#\u{78} = 0;
>this.#\u{78} : Symbol(PrivateIdentifierWithExtendedEscape1[#\u{78}], Decl(PrivateIdentifierNameWithExtendedEscape1.ts, 0, 51))
>this : Symbol(PrivateIdentifierWithExtendedEscape1, Decl(PrivateIdentifierNameWithExtendedEscape1.ts, 0, 0))
}
doThing() {
>doThing : Symbol(PrivateIdentifierWithExtendedEscape1.doThing, Decl(PrivateIdentifierNameWithExtendedEscape1.ts, 5, 5))
this.#x = 42;
>this.#x : Symbol(PrivateIdentifierWithExtendedEscape1[#\u{78}], Decl(PrivateIdentifierNameWithExtendedEscape1.ts, 0, 51))
>this : Symbol(PrivateIdentifierWithExtendedEscape1, Decl(PrivateIdentifierNameWithExtendedEscape1.ts, 0, 0))
}
}
=== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts ===
export class PrivateIdentifierWithExtendedEscape2 {
>PrivateIdentifierWithExtendedEscape2 : Symbol(PrivateIdentifierWithExtendedEscape2, Decl(PrivateIdentifierNameWithExtendedEscape2.ts, 0, 0))
#x\u{78}: number;
>#x\u{78} : Symbol(PrivateIdentifierWithExtendedEscape2.#x\u{78}, Decl(PrivateIdentifierNameWithExtendedEscape2.ts, 0, 51))
constructor() {
this.#x\u{78} = 0;
>this.#x\u{78} : Symbol(PrivateIdentifierWithExtendedEscape2.#x\u{78}, Decl(PrivateIdentifierNameWithExtendedEscape2.ts, 0, 51))
>this : Symbol(PrivateIdentifierWithExtendedEscape2, Decl(PrivateIdentifierNameWithExtendedEscape2.ts, 0, 0))
}
doThing() {
>doThing : Symbol(PrivateIdentifierWithExtendedEscape2.doThing, Decl(PrivateIdentifierNameWithExtendedEscape2.ts, 5, 5))
this.#xx = 42;
>this.#xx : Symbol(PrivateIdentifierWithExtendedEscape2.#x\u{78}, Decl(PrivateIdentifierNameWithExtendedEscape2.ts, 0, 51))
>this : Symbol(PrivateIdentifierWithExtendedEscape2, Decl(PrivateIdentifierNameWithExtendedEscape2.ts, 0, 0))
}
}

View File

@ -0,0 +1,216 @@
=== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithEscape1.ts ===
export class IdentifierNameWithEscape1 {
>IdentifierNameWithEscape1 : IdentifierNameWithEscape1
\u0078: number;
>\u0078 : number
constructor() {
this.\u0078 = 0;
>this.\u0078 = 0 : 0
>this.\u0078 : number
>this : this
>\u0078 : number
>0 : 0
}
doThing() {
>doThing : () => void
this.x = 42;
>this.x = 42 : 42
>this.x : number
>this : this
>x : number
>42 : 42
}
}
=== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithEscape2.ts ===
export class IdentifierNameWithEscape2 {
>IdentifierNameWithEscape2 : IdentifierNameWithEscape2
x\u0078: number;
>x\u0078 : number
constructor() {
this.x\u0078 = 0;
>this.x\u0078 = 0 : 0
>this.x\u0078 : number
>this : this
>x\u0078 : number
>0 : 0
}
doThing() {
>doThing : () => void
this.xx = 42;
>this.xx = 42 : 42
>this.xx : number
>this : this
>xx : number
>42 : 42
}
}
=== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts ===
export class IdentifierNameWithExtendedEscape1 {
>IdentifierNameWithExtendedEscape1 : IdentifierNameWithExtendedEscape1
\u{78}: number;
>\u{78} : number
constructor() {
this.\u{78} = 0;
>this.\u{78} = 0 : 0
>this.\u{78} : number
>this : this
>\u{78} : number
>0 : 0
}
doThing() {
>doThing : () => void
this.x = 42;
>this.x = 42 : 42
>this.x : number
>this : this
>x : number
>42 : 42
}
}
=== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts ===
export class IdentifierNameWithExtendedEscape2 {
>IdentifierNameWithExtendedEscape2 : IdentifierNameWithExtendedEscape2
x\u{78}: number;
>x\u{78} : number
constructor() {
this.x\u{78} = 0;
>this.x\u{78} = 0 : 0
>this.x\u{78} : number
>this : this
>x\u{78} : number
>0 : 0
}
doThing() {
>doThing : () => void
this.xx = 42;
>this.xx = 42 : 42
>this.xx : number
>this : this
>xx : number
>42 : 42
}
}
=== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithEscape1.ts ===
export class PrivateIdentifierWithEscape1 {
>PrivateIdentifierWithEscape1 : PrivateIdentifierWithEscape1
#\u0078: number;
>#\u0078 : number
constructor() {
this.#\u0078 = 0;
>this.#\u0078 = 0 : 0
>this.#\u0078 : number
>this : this
>0 : 0
}
doThing() {
>doThing : () => void
this.#x = 42;
>this.#x = 42 : 42
>this.#x : number
>this : this
>42 : 42
}
}
=== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithEscape2.ts ===
export class PrivateIdentifierWithEscape2 {
>PrivateIdentifierWithEscape2 : PrivateIdentifierWithEscape2
#x\u0078: number;
>#x\u0078 : number
constructor() {
this.#x\u0078 = 0;
>this.#x\u0078 = 0 : 0
>this.#x\u0078 : number
>this : this
>0 : 0
}
doThing() {
>doThing : () => void
this.#xx = 42;
>this.#xx = 42 : 42
>this.#xx : number
>this : this
>42 : 42
}
}
=== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts ===
export class PrivateIdentifierWithExtendedEscape1 {
>PrivateIdentifierWithExtendedEscape1 : PrivateIdentifierWithExtendedEscape1
#\u{78}: number;
>#\u{78} : number
constructor() {
this.#\u{78} = 0;
>this.#\u{78} = 0 : 0
>this.#\u{78} : number
>this : this
>0 : 0
}
doThing() {
>doThing : () => void
this.#x = 42;
>this.#x = 42 : 42
>this.#x : number
>this : this
>42 : 42
}
}
=== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts ===
export class PrivateIdentifierWithExtendedEscape2 {
>PrivateIdentifierWithExtendedEscape2 : PrivateIdentifierWithExtendedEscape2
#x\u{78}: number;
>#x\u{78} : number
constructor() {
this.#x\u{78} = 0;
>this.#x\u{78} = 0 : 0
>this.#x\u{78} : number
>this : this
>0 : 0
}
doThing() {
>doThing : () => void
this.#xx = 42;
>this.#xx = 42 : 42
>this.#xx : number
>this : this
>42 : 42
}
}

View File

@ -0,0 +1,310 @@
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts(2,5): error TS1127: Invalid character.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts(2,6): error TS1434: Unexpected keyword or identifier.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts(2,7): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts(2,11): error TS1128: Declaration or statement expected.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts(2,13): error TS2693: 'number' only refers to a type, but is being used as a value here.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts(4,5): error TS2304: Cannot find name 'constructor'.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts(4,19): error TS1005: ';' expected.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts(5,9): error TS2532: Object is possibly 'undefined'.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts(5,14): error TS1127: Invalid character.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts(5,15): error TS1434: Unexpected keyword or identifier.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts(5,15): error TS2304: Cannot find name 'u'.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts(5,21): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts(8,5): error TS2304: Cannot find name 'doThing'.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts(8,15): error TS1005: ';' expected.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts(9,9): error TS2532: Object is possibly 'undefined'.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts(11,1): error TS1128: Declaration or statement expected.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts(2,6): error TS1127: Invalid character.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts(2,7): error TS1434: Unexpected keyword or identifier.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts(2,8): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts(2,12): error TS1128: Declaration or statement expected.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts(2,14): error TS2693: 'number' only refers to a type, but is being used as a value here.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts(4,5): error TS2304: Cannot find name 'constructor'.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts(4,19): error TS1005: ';' expected.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts(5,9): error TS2532: Object is possibly 'undefined'.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts(5,15): error TS1127: Invalid character.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts(5,16): error TS1434: Unexpected keyword or identifier.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts(5,16): error TS2304: Cannot find name 'u'.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts(5,22): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts(8,5): error TS2304: Cannot find name 'doThing'.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts(8,15): error TS1005: ';' expected.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts(9,9): error TS2532: Object is possibly 'undefined'.
tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts(11,1): error TS1128: Declaration or statement expected.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithEscape1.ts(2,5): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithEscape2.ts(2,5): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(2,5): error TS1127: Invalid character.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(2,6): error TS1127: Invalid character.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(2,7): error TS1434: Unexpected keyword or identifier.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(2,8): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(2,12): error TS1128: Declaration or statement expected.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(2,14): error TS2693: 'number' only refers to a type, but is being used as a value here.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(4,5): error TS2304: Cannot find name 'constructor'.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(4,19): error TS1005: ';' expected.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(5,9): error TS2532: Object is possibly 'undefined'.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(5,14): error TS1127: Invalid character.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(5,15): error TS1127: Invalid character.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(5,16): error TS1434: Unexpected keyword or identifier.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(5,16): error TS2304: Cannot find name 'u'.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(5,22): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(8,5): error TS2304: Cannot find name 'doThing'.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(8,15): error TS1005: ';' expected.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(9,9): error TS2532: Object is possibly 'undefined'.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts(11,1): error TS1128: Declaration or statement expected.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts(2,7): error TS1127: Invalid character.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts(2,8): error TS1434: Unexpected keyword or identifier.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts(2,9): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts(2,13): error TS1128: Declaration or statement expected.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts(2,15): error TS2693: 'number' only refers to a type, but is being used as a value here.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts(4,5): error TS2304: Cannot find name 'constructor'.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts(4,19): error TS1005: ';' expected.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts(5,9): error TS2532: Object is possibly 'undefined'.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts(5,16): error TS1127: Invalid character.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts(5,17): error TS1434: Unexpected keyword or identifier.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts(5,17): error TS2304: Cannot find name 'u'.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts(5,23): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts(8,5): error TS2304: Cannot find name 'doThing'.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts(8,15): error TS1005: ';' expected.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts(9,9): error TS2532: Object is possibly 'undefined'.
tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts(11,1): error TS1128: Declaration or statement expected.
==== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithEscape1.ts (0 errors) ====
export class IdentifierNameWithEscape1 {
\u0078: number;
constructor() {
this.\u0078 = 0;
}
doThing() {
this.x = 42;
}
}
==== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithEscape2.ts (0 errors) ====
export class IdentifierNameWithEscape2 {
x\u0078: number;
constructor() {
this.x\u0078 = 0;
}
doThing() {
this.xx = 42;
}
}
==== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts (16 errors) ====
export class IdentifierNameWithExtendedEscape1 {
\u{78}: number;
!!! error TS1127: Invalid character.
~
!!! error TS1434: Unexpected keyword or identifier.
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~
!!! error TS1128: Declaration or statement expected.
~~~~~~
!!! error TS2693: 'number' only refers to a type, but is being used as a value here.
constructor() {
~~~~~~~~~~~
!!! error TS2304: Cannot find name 'constructor'.
~
!!! error TS1005: ';' expected.
this.\u{78} = 0;
~~~~
!!! error TS2532: Object is possibly 'undefined'.
!!! error TS1127: Invalid character.
~
!!! error TS1434: Unexpected keyword or identifier.
~
!!! error TS2304: Cannot find name 'u'.
~
!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
}
doThing() {
~~~~~~~
!!! error TS2304: Cannot find name 'doThing'.
~
!!! error TS1005: ';' expected.
this.x = 42;
~~~~
!!! error TS2532: Object is possibly 'undefined'.
}
}
~
!!! error TS1128: Declaration or statement expected.
==== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts (16 errors) ====
export class IdentifierNameWithExtendedEscape2 {
x\u{78}: number;
!!! error TS1127: Invalid character.
~
!!! error TS1434: Unexpected keyword or identifier.
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~
!!! error TS1128: Declaration or statement expected.
~~~~~~
!!! error TS2693: 'number' only refers to a type, but is being used as a value here.
constructor() {
~~~~~~~~~~~
!!! error TS2304: Cannot find name 'constructor'.
~
!!! error TS1005: ';' expected.
this.x\u{78} = 0;
~~~~
!!! error TS2532: Object is possibly 'undefined'.
!!! error TS1127: Invalid character.
~
!!! error TS1434: Unexpected keyword or identifier.
~
!!! error TS2304: Cannot find name 'u'.
~
!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
}
doThing() {
~~~~~~~
!!! error TS2304: Cannot find name 'doThing'.
~
!!! error TS1005: ';' expected.
this.xx = 42;
~~~~
!!! error TS2532: Object is possibly 'undefined'.
}
}
~
!!! error TS1128: Declaration or statement expected.
==== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithEscape1.ts (1 errors) ====
export class PrivateIdentifierWithEscape1 {
#\u0078: number;
~~~~~~~
!!! error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
constructor() {
this.#\u0078 = 0;
}
doThing() {
this.#x = 42;
}
}
==== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithEscape2.ts (1 errors) ====
export class PrivateIdentifierWithEscape2 {
#x\u0078: number;
~~~~~~~~
!!! error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
constructor() {
this.#x\u0078 = 0;
}
doThing() {
this.#xx = 42;
}
}
==== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts (18 errors) ====
export class PrivateIdentifierWithExtendedEscape1 {
#\u{78}: number;
~
!!! error TS1127: Invalid character.
!!! error TS1127: Invalid character.
~
!!! error TS1434: Unexpected keyword or identifier.
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~
!!! error TS1128: Declaration or statement expected.
~~~~~~
!!! error TS2693: 'number' only refers to a type, but is being used as a value here.
constructor() {
~~~~~~~~~~~
!!! error TS2304: Cannot find name 'constructor'.
~
!!! error TS1005: ';' expected.
this.#\u{78} = 0;
~~~~
!!! error TS2532: Object is possibly 'undefined'.
~
!!! error TS1127: Invalid character.
!!! error TS1127: Invalid character.
~
!!! error TS1434: Unexpected keyword or identifier.
~
!!! error TS2304: Cannot find name 'u'.
~
!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
}
doThing() {
~~~~~~~
!!! error TS2304: Cannot find name 'doThing'.
~
!!! error TS1005: ';' expected.
this.#x = 42;
~~~~
!!! error TS2532: Object is possibly 'undefined'.
}
}
~
!!! error TS1128: Declaration or statement expected.
==== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts (16 errors) ====
export class PrivateIdentifierWithExtendedEscape2 {
#x\u{78}: number;
!!! error TS1127: Invalid character.
~
!!! error TS1434: Unexpected keyword or identifier.
~
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
~
!!! error TS1128: Declaration or statement expected.
~~~~~~
!!! error TS2693: 'number' only refers to a type, but is being used as a value here.
constructor() {
~~~~~~~~~~~
!!! error TS2304: Cannot find name 'constructor'.
~
!!! error TS1005: ';' expected.
this.#x\u{78} = 0;
~~~~
!!! error TS2532: Object is possibly 'undefined'.
!!! error TS1127: Invalid character.
~
!!! error TS1434: Unexpected keyword or identifier.
~
!!! error TS2304: Cannot find name 'u'.
~
!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
}
doThing() {
~~~~~~~
!!! error TS2304: Cannot find name 'doThing'.
~
!!! error TS1005: ';' expected.
this.#xx = 42;
~~~~
!!! error TS2532: Object is possibly 'undefined'.
}
}
~
!!! error TS1128: Declaration or statement expected.

View File

@ -0,0 +1,295 @@
//// [tests/cases/conformance/classes/members/privateNames/privateNamesEscapeSequences01.ts] ////
//// [IdentifierNameWithEscape1.ts]
export class IdentifierNameWithEscape1 {
\u0078: number;
constructor() {
this.\u0078 = 0;
}
doThing() {
this.x = 42;
}
}
//// [IdentifierNameWithEscape2.ts]
export class IdentifierNameWithEscape2 {
x\u0078: number;
constructor() {
this.x\u0078 = 0;
}
doThing() {
this.xx = 42;
}
}
//// [IdentifierNameWithExtendedEscape1.ts]
export class IdentifierNameWithExtendedEscape1 {
\u{78}: number;
constructor() {
this.\u{78} = 0;
}
doThing() {
this.x = 42;
}
}
//// [IdentifierNameWithExtendedEscape2.ts]
export class IdentifierNameWithExtendedEscape2 {
x\u{78}: number;
constructor() {
this.x\u{78} = 0;
}
doThing() {
this.xx = 42;
}
}
//// [PrivateIdentifierNameWithEscape1.ts]
export class PrivateIdentifierWithEscape1 {
#\u0078: number;
constructor() {
this.#\u0078 = 0;
}
doThing() {
this.#x = 42;
}
}
//// [PrivateIdentifierNameWithEscape2.ts]
export class PrivateIdentifierWithEscape2 {
#x\u0078: number;
constructor() {
this.#x\u0078 = 0;
}
doThing() {
this.#xx = 42;
}
}
//// [PrivateIdentifierNameWithExtendedEscape1.ts]
export class PrivateIdentifierWithExtendedEscape1 {
#\u{78}: number;
constructor() {
this.#\u{78} = 0;
}
doThing() {
this.#x = 42;
}
}
//// [PrivateIdentifierNameWithExtendedEscape2.ts]
export class PrivateIdentifierWithExtendedEscape2 {
#x\u{78}: number;
constructor() {
this.#x\u{78} = 0;
}
doThing() {
this.#xx = 42;
}
}
//// [IdentifierNameWithEscape1.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IdentifierNameWithEscape1 = void 0;
var IdentifierNameWithEscape1 = /** @class */ (function () {
function IdentifierNameWithEscape1() {
this.\u0078 = 0;
}
IdentifierNameWithEscape1.prototype.doThing = function () {
this.x = 42;
};
return IdentifierNameWithEscape1;
}());
exports.IdentifierNameWithEscape1 = IdentifierNameWithEscape1;
//// [IdentifierNameWithEscape2.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IdentifierNameWithEscape2 = void 0;
var IdentifierNameWithEscape2 = /** @class */ (function () {
function IdentifierNameWithEscape2() {
this.x\u0078 = 0;
}
IdentifierNameWithEscape2.prototype.doThing = function () {
this.xx = 42;
};
return IdentifierNameWithEscape2;
}());
exports.IdentifierNameWithEscape2 = IdentifierNameWithEscape2;
//// [IdentifierNameWithExtendedEscape1.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IdentifierNameWithExtendedEscape1 = void 0;
var IdentifierNameWithExtendedEscape1 = /** @class */ (function () {
function IdentifierNameWithExtendedEscape1() {
}
return IdentifierNameWithExtendedEscape1;
}());
exports.IdentifierNameWithExtendedEscape1 = IdentifierNameWithExtendedEscape1;
{
78;
}
number;
constructor();
{
this.;
u;
{
78;
}
0;
}
doThing();
{
this.x = 42;
}
//// [IdentifierNameWithExtendedEscape2.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IdentifierNameWithExtendedEscape2 = void 0;
var IdentifierNameWithExtendedEscape2 = /** @class */ (function () {
function IdentifierNameWithExtendedEscape2() {
}
return IdentifierNameWithExtendedEscape2;
}());
exports.IdentifierNameWithExtendedEscape2 = IdentifierNameWithExtendedEscape2;
{
78;
}
number;
constructor();
{
this.x;
u;
{
78;
}
0;
}
doThing();
{
this.xx = 42;
}
//// [PrivateIdentifierNameWithEscape1.js]
"use strict";
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _PrivateIdentifierWithEscape1_x;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PrivateIdentifierWithEscape1 = void 0;
var PrivateIdentifierWithEscape1 = /** @class */ (function () {
function PrivateIdentifierWithEscape1() {
_PrivateIdentifierWithEscape1_x.set(this, void 0);
__classPrivateFieldSet(this, _PrivateIdentifierWithEscape1_x, 0, "f");
}
PrivateIdentifierWithEscape1.prototype.doThing = function () {
__classPrivateFieldSet(this, _PrivateIdentifierWithEscape1_x, 42, "f");
};
return PrivateIdentifierWithEscape1;
}());
exports.PrivateIdentifierWithEscape1 = PrivateIdentifierWithEscape1;
_PrivateIdentifierWithEscape1_x = new WeakMap();
//// [PrivateIdentifierNameWithEscape2.js]
"use strict";
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _PrivateIdentifierWithEscape2_xx;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PrivateIdentifierWithEscape2 = void 0;
var PrivateIdentifierWithEscape2 = /** @class */ (function () {
function PrivateIdentifierWithEscape2() {
_PrivateIdentifierWithEscape2_xx.set(this, void 0);
__classPrivateFieldSet(this, _PrivateIdentifierWithEscape2_xx, 0, "f");
}
PrivateIdentifierWithEscape2.prototype.doThing = function () {
__classPrivateFieldSet(this, _PrivateIdentifierWithEscape2_xx, 42, "f");
};
return PrivateIdentifierWithEscape2;
}());
exports.PrivateIdentifierWithEscape2 = PrivateIdentifierWithEscape2;
_PrivateIdentifierWithEscape2_xx = new WeakMap();
//// [PrivateIdentifierNameWithExtendedEscape1.js]
"use strict";
var _PrivateIdentifierWithExtendedEscape1_;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PrivateIdentifierWithExtendedEscape1 = void 0;
var PrivateIdentifierWithExtendedEscape1 = /** @class */ (function () {
function PrivateIdentifierWithExtendedEscape1() {
_PrivateIdentifierWithExtendedEscape1_.set(this, void 0);
}
return PrivateIdentifierWithExtendedEscape1;
}());
exports.PrivateIdentifierWithExtendedEscape1 = PrivateIdentifierWithExtendedEscape1;
_PrivateIdentifierWithExtendedEscape1_ = new WeakMap();
{
78;
}
number;
constructor();
{
this.;
u;
{
78;
}
0;
}
doThing();
{
this. = 42;
}
//// [PrivateIdentifierNameWithExtendedEscape2.js]
"use strict";
var _PrivateIdentifierWithExtendedEscape2_x;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PrivateIdentifierWithExtendedEscape2 = void 0;
var PrivateIdentifierWithExtendedEscape2 = /** @class */ (function () {
function PrivateIdentifierWithExtendedEscape2() {
_PrivateIdentifierWithExtendedEscape2_x.set(this, void 0);
}
return PrivateIdentifierWithExtendedEscape2;
}());
exports.PrivateIdentifierWithExtendedEscape2 = PrivateIdentifierWithExtendedEscape2;
_PrivateIdentifierWithExtendedEscape2_x = new WeakMap();
{
78;
}
number;
constructor();
{
this.;
u;
{
78;
}
0;
}
doThing();
{
this. = 42;
}

View File

@ -0,0 +1,159 @@
=== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithEscape1.ts ===
export class IdentifierNameWithEscape1 {
>IdentifierNameWithEscape1 : Symbol(IdentifierNameWithEscape1, Decl(IdentifierNameWithEscape1.ts, 0, 0))
\u0078: number;
>\u0078 : Symbol(IdentifierNameWithEscape1[\u0078], Decl(IdentifierNameWithEscape1.ts, 0, 40))
constructor() {
this.\u0078 = 0;
>this.\u0078 : Symbol(IdentifierNameWithEscape1[\u0078], Decl(IdentifierNameWithEscape1.ts, 0, 40))
>this : Symbol(IdentifierNameWithEscape1, Decl(IdentifierNameWithEscape1.ts, 0, 0))
>\u0078 : Symbol(IdentifierNameWithEscape1[\u0078], Decl(IdentifierNameWithEscape1.ts, 0, 40))
}
doThing() {
>doThing : Symbol(IdentifierNameWithEscape1.doThing, Decl(IdentifierNameWithEscape1.ts, 5, 5))
this.x = 42;
>this.x : Symbol(IdentifierNameWithEscape1[\u0078], Decl(IdentifierNameWithEscape1.ts, 0, 40))
>this : Symbol(IdentifierNameWithEscape1, Decl(IdentifierNameWithEscape1.ts, 0, 0))
>x : Symbol(IdentifierNameWithEscape1[\u0078], Decl(IdentifierNameWithEscape1.ts, 0, 40))
}
}
=== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithEscape2.ts ===
export class IdentifierNameWithEscape2 {
>IdentifierNameWithEscape2 : Symbol(IdentifierNameWithEscape2, Decl(IdentifierNameWithEscape2.ts, 0, 0))
x\u0078: number;
>x\u0078 : Symbol(IdentifierNameWithEscape2.x\u0078, Decl(IdentifierNameWithEscape2.ts, 0, 40))
constructor() {
this.x\u0078 = 0;
>this.x\u0078 : Symbol(IdentifierNameWithEscape2.x\u0078, Decl(IdentifierNameWithEscape2.ts, 0, 40))
>this : Symbol(IdentifierNameWithEscape2, Decl(IdentifierNameWithEscape2.ts, 0, 0))
>x\u0078 : Symbol(IdentifierNameWithEscape2.x\u0078, Decl(IdentifierNameWithEscape2.ts, 0, 40))
}
doThing() {
>doThing : Symbol(IdentifierNameWithEscape2.doThing, Decl(IdentifierNameWithEscape2.ts, 5, 5))
this.xx = 42;
>this.xx : Symbol(IdentifierNameWithEscape2.x\u0078, Decl(IdentifierNameWithEscape2.ts, 0, 40))
>this : Symbol(IdentifierNameWithEscape2, Decl(IdentifierNameWithEscape2.ts, 0, 0))
>xx : Symbol(IdentifierNameWithEscape2.x\u0078, Decl(IdentifierNameWithEscape2.ts, 0, 40))
}
}
=== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts ===
export class IdentifierNameWithExtendedEscape1 {
>IdentifierNameWithExtendedEscape1 : Symbol(IdentifierNameWithExtendedEscape1, Decl(IdentifierNameWithExtendedEscape1.ts, 0, 0))
\u{78}: number;
>u : Symbol(IdentifierNameWithExtendedEscape1.u, Decl(IdentifierNameWithExtendedEscape1.ts, 1, 5))
constructor() {
this.\u{78} = 0;
}
doThing() {
this.x = 42;
}
}
=== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts ===
export class IdentifierNameWithExtendedEscape2 {
>IdentifierNameWithExtendedEscape2 : Symbol(IdentifierNameWithExtendedEscape2, Decl(IdentifierNameWithExtendedEscape2.ts, 0, 0))
x\u{78}: number;
>x : Symbol(IdentifierNameWithExtendedEscape2.x, Decl(IdentifierNameWithExtendedEscape2.ts, 0, 48))
>u : Symbol(IdentifierNameWithExtendedEscape2.u, Decl(IdentifierNameWithExtendedEscape2.ts, 1, 6))
constructor() {
this.x\u{78} = 0;
}
doThing() {
this.xx = 42;
}
}
=== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithEscape1.ts ===
export class PrivateIdentifierWithEscape1 {
>PrivateIdentifierWithEscape1 : Symbol(PrivateIdentifierWithEscape1, Decl(PrivateIdentifierNameWithEscape1.ts, 0, 0))
#\u0078: number;
>#\u0078 : Symbol(PrivateIdentifierWithEscape1[#\u0078], Decl(PrivateIdentifierNameWithEscape1.ts, 0, 43))
constructor() {
this.#\u0078 = 0;
>this.#\u0078 : Symbol(PrivateIdentifierWithEscape1[#\u0078], Decl(PrivateIdentifierNameWithEscape1.ts, 0, 43))
>this : Symbol(PrivateIdentifierWithEscape1, Decl(PrivateIdentifierNameWithEscape1.ts, 0, 0))
}
doThing() {
>doThing : Symbol(PrivateIdentifierWithEscape1.doThing, Decl(PrivateIdentifierNameWithEscape1.ts, 5, 5))
this.#x = 42;
>this.#x : Symbol(PrivateIdentifierWithEscape1[#\u0078], Decl(PrivateIdentifierNameWithEscape1.ts, 0, 43))
>this : Symbol(PrivateIdentifierWithEscape1, Decl(PrivateIdentifierNameWithEscape1.ts, 0, 0))
}
}
=== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithEscape2.ts ===
export class PrivateIdentifierWithEscape2 {
>PrivateIdentifierWithEscape2 : Symbol(PrivateIdentifierWithEscape2, Decl(PrivateIdentifierNameWithEscape2.ts, 0, 0))
#x\u0078: number;
>#x\u0078 : Symbol(PrivateIdentifierWithEscape2.#x\u0078, Decl(PrivateIdentifierNameWithEscape2.ts, 0, 43))
constructor() {
this.#x\u0078 = 0;
>this.#x\u0078 : Symbol(PrivateIdentifierWithEscape2.#x\u0078, Decl(PrivateIdentifierNameWithEscape2.ts, 0, 43))
>this : Symbol(PrivateIdentifierWithEscape2, Decl(PrivateIdentifierNameWithEscape2.ts, 0, 0))
}
doThing() {
>doThing : Symbol(PrivateIdentifierWithEscape2.doThing, Decl(PrivateIdentifierNameWithEscape2.ts, 5, 5))
this.#xx = 42;
>this.#xx : Symbol(PrivateIdentifierWithEscape2.#x\u0078, Decl(PrivateIdentifierNameWithEscape2.ts, 0, 43))
>this : Symbol(PrivateIdentifierWithEscape2, Decl(PrivateIdentifierNameWithEscape2.ts, 0, 0))
}
}
=== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts ===
export class PrivateIdentifierWithExtendedEscape1 {
>PrivateIdentifierWithExtendedEscape1 : Symbol(PrivateIdentifierWithExtendedEscape1, Decl(PrivateIdentifierNameWithExtendedEscape1.ts, 0, 0))
#\u{78}: number;
># : Symbol(PrivateIdentifierWithExtendedEscape1[#], Decl(PrivateIdentifierNameWithExtendedEscape1.ts, 0, 51))
>u : Symbol(PrivateIdentifierWithExtendedEscape1.u, Decl(PrivateIdentifierNameWithExtendedEscape1.ts, 1, 6))
constructor() {
this.#\u{78} = 0;
}
doThing() {
this.#x = 42;
}
}
=== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts ===
export class PrivateIdentifierWithExtendedEscape2 {
>PrivateIdentifierWithExtendedEscape2 : Symbol(PrivateIdentifierWithExtendedEscape2, Decl(PrivateIdentifierNameWithExtendedEscape2.ts, 0, 0))
#x\u{78}: number;
>#x : Symbol(PrivateIdentifierWithExtendedEscape2.#x, Decl(PrivateIdentifierNameWithExtendedEscape2.ts, 0, 51))
>u : Symbol(PrivateIdentifierWithExtendedEscape2.u, Decl(PrivateIdentifierNameWithExtendedEscape2.ts, 1, 7))
constructor() {
this.#x\u{78} = 0;
}
doThing() {
this.#xx = 42;
}
}

View File

@ -0,0 +1,247 @@
=== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithEscape1.ts ===
export class IdentifierNameWithEscape1 {
>IdentifierNameWithEscape1 : IdentifierNameWithEscape1
\u0078: number;
>\u0078 : number
constructor() {
this.\u0078 = 0;
>this.\u0078 = 0 : 0
>this.\u0078 : number
>this : this
>\u0078 : number
>0 : 0
}
doThing() {
>doThing : () => void
this.x = 42;
>this.x = 42 : 42
>this.x : number
>this : this
>x : number
>42 : 42
}
}
=== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithEscape2.ts ===
export class IdentifierNameWithEscape2 {
>IdentifierNameWithEscape2 : IdentifierNameWithEscape2
x\u0078: number;
>x\u0078 : number
constructor() {
this.x\u0078 = 0;
>this.x\u0078 = 0 : 0
>this.x\u0078 : number
>this : this
>x\u0078 : number
>0 : 0
}
doThing() {
>doThing : () => void
this.xx = 42;
>this.xx = 42 : 42
>this.xx : number
>this : this
>xx : number
>42 : 42
}
}
=== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape1.ts ===
export class IdentifierNameWithExtendedEscape1 {
>IdentifierNameWithExtendedEscape1 : IdentifierNameWithExtendedEscape1
\u{78}: number;
>u : any
>78 : 78
>number : any
constructor() {
>constructor() : any
>constructor : any
this.\u{78} = 0;
>this. : any
>this : undefined
> : any
>u : any
>78 : 78
>0 : 0
}
doThing() {
>doThing() : any
>doThing : any
this.x = 42;
>this.x = 42 : 42
>this.x : any
>this : undefined
>x : any
>42 : 42
}
}
=== tests/cases/conformance/classes/members/privateNames/IdentifierNameWithExtendedEscape2.ts ===
export class IdentifierNameWithExtendedEscape2 {
>IdentifierNameWithExtendedEscape2 : IdentifierNameWithExtendedEscape2
x\u{78}: number;
>x : any
>u : any
>78 : 78
>number : any
constructor() {
>constructor() : any
>constructor : any
this.x\u{78} = 0;
>this.x : any
>this : undefined
>x : any
>u : any
>78 : 78
>0 : 0
}
doThing() {
>doThing() : any
>doThing : any
this.xx = 42;
>this.xx = 42 : 42
>this.xx : any
>this : undefined
>xx : any
>42 : 42
}
}
=== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithEscape1.ts ===
export class PrivateIdentifierWithEscape1 {
>PrivateIdentifierWithEscape1 : PrivateIdentifierWithEscape1
#\u0078: number;
>#\u0078 : number
constructor() {
this.#\u0078 = 0;
>this.#\u0078 = 0 : 0
>this.#\u0078 : number
>this : this
>0 : 0
}
doThing() {
>doThing : () => void
this.#x = 42;
>this.#x = 42 : 42
>this.#x : number
>this : this
>42 : 42
}
}
=== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithEscape2.ts ===
export class PrivateIdentifierWithEscape2 {
>PrivateIdentifierWithEscape2 : PrivateIdentifierWithEscape2
#x\u0078: number;
>#x\u0078 : number
constructor() {
this.#x\u0078 = 0;
>this.#x\u0078 = 0 : 0
>this.#x\u0078 : number
>this : this
>0 : 0
}
doThing() {
>doThing : () => void
this.#xx = 42;
>this.#xx = 42 : 42
>this.#xx : number
>this : this
>42 : 42
}
}
=== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape1.ts ===
export class PrivateIdentifierWithExtendedEscape1 {
>PrivateIdentifierWithExtendedEscape1 : PrivateIdentifierWithExtendedEscape1
#\u{78}: number;
># : any
>u : any
>78 : 78
>number : any
constructor() {
>constructor() : any
>constructor : any
this.#\u{78} = 0;
>this.# : any
>this : undefined
>u : any
>78 : 78
>0 : 0
}
doThing() {
>doThing() : any
>doThing : any
this.#x = 42;
>this.#x = 42 : 42
>this.#x : any
>this : undefined
>42 : 42
}
}
=== tests/cases/conformance/classes/members/privateNames/PrivateIdentifierNameWithExtendedEscape2.ts ===
export class PrivateIdentifierWithExtendedEscape2 {
>PrivateIdentifierWithExtendedEscape2 : PrivateIdentifierWithExtendedEscape2
#x\u{78}: number;
>#x : any
>u : any
>78 : 78
>number : any
constructor() {
>constructor() : any
>constructor : any
this.#x\u{78} = 0;
>this.#x : any
>this : undefined
>u : any
>78 : 78
>0 : 0
}
doThing() {
>doThing() : any
>doThing : any
this.#xx = 42;
>this.#xx = 42 : 42
>this.#xx : any
>this : undefined
>42 : 42
}
}

View File

@ -0,0 +1,105 @@
// @target: es5,es2015
// @filename: IdentifierNameWithEscape1.ts
export class IdentifierNameWithEscape1 {
\u0078: number;
constructor() {
this.\u0078 = 0;
}
doThing() {
this.x = 42;
}
}
// @filename: IdentifierNameWithEscape2.ts
export class IdentifierNameWithEscape2 {
x\u0078: number;
constructor() {
this.x\u0078 = 0;
}
doThing() {
this.xx = 42;
}
}
// @filename: IdentifierNameWithExtendedEscape1.ts
export class IdentifierNameWithExtendedEscape1 {
\u{78}: number;
constructor() {
this.\u{78} = 0;
}
doThing() {
this.x = 42;
}
}
// @filename: IdentifierNameWithExtendedEscape2.ts
export class IdentifierNameWithExtendedEscape2 {
x\u{78}: number;
constructor() {
this.x\u{78} = 0;
}
doThing() {
this.xx = 42;
}
}
// @filename: PrivateIdentifierNameWithEscape1.ts
export class PrivateIdentifierWithEscape1 {
#\u0078: number;
constructor() {
this.#\u0078 = 0;
}
doThing() {
this.#x = 42;
}
}
// @filename: PrivateIdentifierNameWithEscape2.ts
export class PrivateIdentifierWithEscape2 {
#x\u0078: number;
constructor() {
this.#x\u0078 = 0;
}
doThing() {
this.#xx = 42;
}
}
// @filename: PrivateIdentifierNameWithExtendedEscape1.ts
export class PrivateIdentifierWithExtendedEscape1 {
#\u{78}: number;
constructor() {
this.#\u{78} = 0;
}
doThing() {
this.#x = 42;
}
}
// @filename: PrivateIdentifierNameWithExtendedEscape2.ts
export class PrivateIdentifierWithExtendedEscape2 {
#x\u{78}: number;
constructor() {
this.#x\u{78} = 0;
}
doThing() {
this.#xx = 42;
}
}