Skip to content

Commit 5294e92

Browse files
committed
Use switch instead of instatating an array and when looking inside a module
1 parent 77cdca2 commit 5294e92

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/compiler/parser.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -2434,9 +2434,16 @@ namespace ts {
24342434
const moduleSpecifier = parseOptionalToken(SyntaxKind.ModuleKeyword);
24352435
if (moduleSpecifier) {
24362436
const moduleTag = createNode(SyntaxKind.JSDocNamepathType, moduleSpecifier.pos) as JSDocNamepathType;
2437-
const terminators = [SyntaxKind.CloseBraceToken, SyntaxKind.EndOfFileToken, SyntaxKind.CommaToken, SyntaxKind.CloseParenToken, SyntaxKind.WhitespaceTrivia];
2438-
while (terminators.indexOf(token()) < 0) {
2439-
nextTokenJSDoc();
2437+
terminate: while (true) {
2438+
switch (token()) {
2439+
case SyntaxKind.CloseBraceToken:
2440+
case SyntaxKind.EndOfFileToken:
2441+
case SyntaxKind.CommaToken:
2442+
case SyntaxKind.WhitespaceTrivia:
2443+
break terminate;
2444+
default:
2445+
nextTokenJSDoc();
2446+
}
24402447
}
24412448

24422449
scanner.setInJSDocType(false);

0 commit comments

Comments
 (0)