Skip to content

Commit e50667e

Browse files
author
Yui T
committed
Address minor PR comment
1 parent a10e668 commit e50667e

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17134,10 +17134,11 @@ namespace ts {
1713417134
case SyntaxKind.ElementAccessExpression:
1713517135
return checkIndexedAccess(<ElementAccessExpression>node);
1713617136
case SyntaxKind.CallExpression:
17137-
case SyntaxKind.NewExpression:
1713817137
if ((<CallExpression>node).expression.kind === SyntaxKind.ImportKeyword) {
1713917138
return checkImportCallExpression(<ImportCall>node);
1714017139
}
17140+
// Fall through
17141+
case SyntaxKind.NewExpression:
1714117142
return checkCallExpression(<CallExpression>node);
1714217143
case SyntaxKind.TaggedTemplateExpression:
1714317144
return checkTaggedTemplateExpression(<TaggedTemplateExpression>node);

src/compiler/parser.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2416,7 +2416,7 @@ namespace ts {
24162416
if (token() === SyntaxKind.OpenParenToken || token() === SyntaxKind.LessThanToken) {
24172417
return parseSignatureMember(SyntaxKind.CallSignature);
24182418
}
2419-
if (token() === SyntaxKind.NewKeyword && lookAhead(isStartOfConstructSignature)) {
2419+
if (token() === SyntaxKind.NewKeyword && lookAhead(nextTokenIsOpenParenOrLessThan)) {
24202420
return parseSignatureMember(SyntaxKind.ConstructSignature);
24212421
}
24222422
const fullStart = getNodePos();
@@ -2427,7 +2427,7 @@ namespace ts {
24272427
return parsePropertyOrMethodSignature(fullStart, modifiers);
24282428
}
24292429

2430-
function isStartOfConstructSignature() {
2430+
function nextTokenIsOpenParenOrLessThan() {
24312431
nextToken();
24322432
return token() === SyntaxKind.OpenParenToken || token() === SyntaxKind.LessThanToken;
24332433
}
@@ -5619,11 +5619,6 @@ namespace ts {
56195619
return nextToken() === SyntaxKind.OpenParenToken;
56205620
}
56215621

5622-
function nextTokenIsOpenParenOrLessThan() {
5623-
const next = nextToken();
5624-
return next === SyntaxKind.OpenParenToken || next === SyntaxKind.LessThanToken;
5625-
}
5626-
56275622
function nextTokenIsSlash() {
56285623
return nextToken() === SyntaxKind.SlashToken;
56295624
}

src/compiler/program.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,10 @@ namespace ts {
11991199
}
12001200

12011201
function collectExternalModuleReferences(file: SourceFile): void {
1202+
if (file.imports) {
1203+
return;
1204+
}
1205+
12021206
const isJavaScriptFile = isSourceFileJavaScript(file);
12031207
const isExternalModuleFile = isExternalModule(file);
12041208
const isDtsFile = isDeclarationFile(file);

0 commit comments

Comments
 (0)