Skip to content

Commit

Permalink
Use switch instead of instatating an array and when looking inside a …
Browse files Browse the repository at this point in the history
…module
  • Loading branch information
orta committed Aug 9, 2019
1 parent 77cdca2 commit 5294e92
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2434,9 +2434,16 @@ namespace ts {
const moduleSpecifier = parseOptionalToken(SyntaxKind.ModuleKeyword);
if (moduleSpecifier) {
const moduleTag = createNode(SyntaxKind.JSDocNamepathType, moduleSpecifier.pos) as JSDocNamepathType;
const terminators = [SyntaxKind.CloseBraceToken, SyntaxKind.EndOfFileToken, SyntaxKind.CommaToken, SyntaxKind.CloseParenToken, SyntaxKind.WhitespaceTrivia];
while (terminators.indexOf(token()) < 0) {
nextTokenJSDoc();
terminate: while (true) {
switch (token()) {
case SyntaxKind.CloseBraceToken:
case SyntaxKind.EndOfFileToken:
case SyntaxKind.CommaToken:
case SyntaxKind.WhitespaceTrivia:
break terminate;
default:
nextTokenJSDoc();
}
}

scanner.setInJSDocType(false);
Expand Down

0 comments on commit 5294e92

Please sign in to comment.