Skip to content

Commit 952715c

Browse files
Try adding originalKeywordKind to the prototype as an experiment.
1 parent ac172de commit 952715c

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/compiler/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,6 +1685,9 @@ export interface Identifier extends PrimaryExpression, Declaration, JSDocContain
16851685
isInJSDocNamespace?: boolean; // if the node is a member in a JSDoc namespace
16861686
/** @internal */ typeArguments?: NodeArray<TypeNode | TypeParameterDeclaration>; // Only defined on synthesized nodes. Though not syntactically valid, used in emitting diagnostics, quickinfo, and signature help.
16871687
/** @internal */ jsdocDotPos?: number; // Identifier occurs in JSDoc-style generic: Id.<T>
1688+
/**
1689+
* @deprecated `originalKeywordKind` will be removed in the future.
1690+
*/ readonly originalKeywordKind?: SyntaxKind;
16881691
/**@internal*/ hasExtendedUnicodeEscape?: boolean;
16891692
}
16901693

src/compiler/utilities.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7317,6 +7317,12 @@ function Identifier(this: Mutable<Node>, kind: SyntaxKind, pos: number, end: num
73177317
(this as Identifier).flowNode = undefined;
73187318
}
73197319

7320+
Object.defineProperty(Identifier.prototype, "originalKeywordKind" satisfies keyof Identifier, {
7321+
get(this: Identifier) {
7322+
return stringToToken(this.escapedText as string);
7323+
}
7324+
});
7325+
73207326
function SourceMapSource(this: SourceMapSource, fileName: string, text: string, skipTrivia?: (pos: number) => number) {
73217327
this.fileName = fileName;
73227328
this.text = text;

0 commit comments

Comments
 (0)