From e50667e49e82961288a40e810c470492357b60ba Mon Sep 17 00:00:00 2001 From: Yui T Date: Wed, 26 Apr 2017 15:02:54 -0700 Subject: [PATCH] Address minor PR comment --- src/compiler/checker.ts | 3 ++- src/compiler/parser.ts | 9 ++------- src/compiler/program.ts | 4 ++++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8eb163e7aa8..10d96581656 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -17134,10 +17134,11 @@ namespace ts { case SyntaxKind.ElementAccessExpression: return checkIndexedAccess(node); case SyntaxKind.CallExpression: - case SyntaxKind.NewExpression: if ((node).expression.kind === SyntaxKind.ImportKeyword) { return checkImportCallExpression(node); } + // Fall through + case SyntaxKind.NewExpression: return checkCallExpression(node); case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(node); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 2293934baf1..f5577c4b908 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2416,7 +2416,7 @@ namespace ts { if (token() === SyntaxKind.OpenParenToken || token() === SyntaxKind.LessThanToken) { return parseSignatureMember(SyntaxKind.CallSignature); } - if (token() === SyntaxKind.NewKeyword && lookAhead(isStartOfConstructSignature)) { + if (token() === SyntaxKind.NewKeyword && lookAhead(nextTokenIsOpenParenOrLessThan)) { return parseSignatureMember(SyntaxKind.ConstructSignature); } const fullStart = getNodePos(); @@ -2427,7 +2427,7 @@ namespace ts { return parsePropertyOrMethodSignature(fullStart, modifiers); } - function isStartOfConstructSignature() { + function nextTokenIsOpenParenOrLessThan() { nextToken(); return token() === SyntaxKind.OpenParenToken || token() === SyntaxKind.LessThanToken; } @@ -5619,11 +5619,6 @@ namespace ts { return nextToken() === SyntaxKind.OpenParenToken; } - function nextTokenIsOpenParenOrLessThan() { - const next = nextToken(); - return next === SyntaxKind.OpenParenToken || next === SyntaxKind.LessThanToken; - } - function nextTokenIsSlash() { return nextToken() === SyntaxKind.SlashToken; } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 04acf667343..05dc96cf5cb 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1199,6 +1199,10 @@ namespace ts { } function collectExternalModuleReferences(file: SourceFile): void { + if (file.imports) { + return; + } + const isJavaScriptFile = isSourceFileJavaScript(file); const isExternalModuleFile = isExternalModule(file); const isDtsFile = isDeclarationFile(file);