Skip to content

Commit 5410233

Browse files
committed
Merge branch 'Swatinem-separate-nodetypes'
2 parents 01c86c7 + 195f6bb commit 5410233

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

src/compiler/utilities.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4225,6 +4225,9 @@ namespace ts {
42254225
}
42264226

42274227
export function getModifierFlags(node: Node): ModifierFlags {
4228+
if (node.kind >= SyntaxKind.FirstToken && node.kind <= SyntaxKind.LastToken) {
4229+
return ModifierFlags.None;
4230+
}
42284231
if (node.modifierFlagsCache & ModifierFlags.HasComputedFlags) {
42294232
return node.modifierFlagsCache & ~ModifierFlags.HasComputedFlags;
42304233
}
@@ -5072,6 +5075,28 @@ namespace ts {
50725075
this.original = undefined;
50735076
}
50745077

5078+
function Token(this: Node, kind: SyntaxKind, pos: number, end: number) {
5079+
this.pos = pos;
5080+
this.end = end;
5081+
this.kind = kind;
5082+
this.id = 0;
5083+
this.flags = NodeFlags.None;
5084+
this.transformFlags = TransformFlags.None;
5085+
this.parent = undefined!;
5086+
}
5087+
5088+
function Identifier(this: Node, kind: SyntaxKind, pos: number, end: number) {
5089+
this.pos = pos;
5090+
this.end = end;
5091+
this.kind = kind;
5092+
this.id = 0;
5093+
this.flags = NodeFlags.None;
5094+
this.transformFlags = TransformFlags.None;
5095+
this.parent = undefined!;
5096+
this.original = undefined;
5097+
this.flowNode = undefined;
5098+
}
5099+
50755100
function SourceMapSource(this: SourceMapSource, fileName: string, text: string, skipTrivia?: (pos: number) => number) {
50765101
this.fileName = fileName;
50775102
this.text = text;
@@ -5081,8 +5106,8 @@ namespace ts {
50815106
// eslint-disable-next-line prefer-const
50825107
export let objectAllocator: ObjectAllocator = {
50835108
getNodeConstructor: () => <any>Node,
5084-
getTokenConstructor: () => <any>Node,
5085-
getIdentifierConstructor: () => <any>Node,
5109+
getTokenConstructor: () => <any>Token,
5110+
getIdentifierConstructor: () => <any>Identifier,
50865111
getPrivateIdentifierConstructor: () => <any>Node,
50875112
getSourceFileConstructor: () => <any>Node,
50885113
getSymbolConstructor: () => <any>Symbol,

0 commit comments

Comments
 (0)