Skip to content

Commit 2d3dd85

Browse files
author
Andy Hanson
committed
Simplify parseTypeReference
Create the node first, rather than creating it later and setting its pos to another node that was created first.
1 parent 1c64943 commit 2d3dd85

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/compiler/parser.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,9 +2054,8 @@ namespace ts {
20542054
// TYPES
20552055

20562056
function parseTypeReference(): TypeReferenceNode {
2057-
const typeName = parseEntityName(/*allowReservedWords*/ false, Diagnostics.Type_expected);
2058-
const node = <TypeReferenceNode>createNode(SyntaxKind.TypeReference, typeName.pos);
2059-
node.typeName = typeName;
2057+
const node = <TypeReferenceNode>createNode(SyntaxKind.TypeReference);
2058+
node.typeName = parseEntityName(/*allowReservedWords*/ false, Diagnostics.Type_expected);
20602059
if (!scanner.hasPrecedingLineBreak() && token() === SyntaxKind.LessThanToken) {
20612060
node.typeArguments = parseBracketedList(ParsingContext.TypeArguments, parseType, SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken);
20622061
}

0 commit comments

Comments
 (0)