Simplify parseTypeReference
Create the node first, rather than creating it later and setting its pos to another node that was created first.
This commit is contained in:
parent
1c649433bd
commit
2d3dd85632
1 changed files with 2 additions and 3 deletions
|
@ -2054,9 +2054,8 @@ namespace ts {
|
||||||
// TYPES
|
// TYPES
|
||||||
|
|
||||||
function parseTypeReference(): TypeReferenceNode {
|
function parseTypeReference(): TypeReferenceNode {
|
||||||
const typeName = parseEntityName(/*allowReservedWords*/ false, Diagnostics.Type_expected);
|
const node = <TypeReferenceNode>createNode(SyntaxKind.TypeReference);
|
||||||
const node = <TypeReferenceNode>createNode(SyntaxKind.TypeReference, typeName.pos);
|
node.typeName = parseEntityName(/*allowReservedWords*/ false, Diagnostics.Type_expected);
|
||||||
node.typeName = typeName;
|
|
||||||
if (!scanner.hasPrecedingLineBreak() && token() === SyntaxKind.LessThanToken) {
|
if (!scanner.hasPrecedingLineBreak() && token() === SyntaxKind.LessThanToken) {
|
||||||
node.typeArguments = parseBracketedList(ParsingContext.TypeArguments, parseType, SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken);
|
node.typeArguments = parseBracketedList(ParsingContext.TypeArguments, parseType, SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue