From a796817dd3933e5523b6486c9f320c6cff2ea6be Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Thu, 8 Jun 2017 14:13:17 -0700 Subject: [PATCH] Update LKG --- lib/tsc.js | 10 ++++++---- lib/tsserver.js | 19 ++++++++++++++----- lib/tsserverlibrary.js | 19 ++++++++++++++----- lib/typescript.js | 24 ++++++++++++++++++------ lib/typescriptServices.js | 24 ++++++++++++++++++------ 5 files changed, 70 insertions(+), 26 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index 23242d5d9e7..76bbdae7641 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -13418,7 +13418,9 @@ var ts; } ts.isExternalModule = isExternalModule; function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { - return IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); + var newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); + newSourceFile.flags |= (sourceFile.flags & 524288); + return newSourceFile; } ts.updateSourceFile = updateSourceFile; function parseIsolatedJSDocComment(content, start, length) { @@ -48812,14 +48814,14 @@ var ts; } function visitImportCallExpression(node) { switch (compilerOptions.module) { - case ts.ModuleKind.CommonJS: - return transformImportCallExpressionCommonJS(node); case ts.ModuleKind.AMD: return transformImportCallExpressionAMD(node); case ts.ModuleKind.UMD: return transformImportCallExpressionUMD(node); + case ts.ModuleKind.CommonJS: + default: + return transformImportCallExpressionCommonJS(node); } - ts.Debug.fail("All supported module kind in this transformation step should have been handled"); } function transformImportCallExpressionUMD(node) { needUMDDynamicImportHelper = true; diff --git a/lib/tsserver.js b/lib/tsserver.js index 3e0c69fb2b8..c3927968a71 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -15255,7 +15255,9 @@ var ts; } ts.isExternalModule = isExternalModule; function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { - return IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); + var newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); + newSourceFile.flags |= (sourceFile.flags & 524288); + return newSourceFile; } ts.updateSourceFile = updateSourceFile; function parseIsolatedJSDocComment(content, start, length) { @@ -50162,14 +50164,14 @@ var ts; } function visitImportCallExpression(node) { switch (compilerOptions.module) { - case ts.ModuleKind.CommonJS: - return transformImportCallExpressionCommonJS(node); case ts.ModuleKind.AMD: return transformImportCallExpressionAMD(node); case ts.ModuleKind.UMD: return transformImportCallExpressionUMD(node); + case ts.ModuleKind.CommonJS: + default: + return transformImportCallExpressionCommonJS(node); } - ts.Debug.fail("All supported module kind in this transformation step should have been handled"); } function transformImportCallExpressionUMD(node) { needUMDDynamicImportHelper = true; @@ -67631,7 +67633,14 @@ var ts; var token = ts.scanner.getToken(); if (token === 91) { token = nextToken(); - if (token === 9) { + if (token === 19) { + token = nextToken(); + if (token === 9) { + recordModuleName(); + return true; + } + } + else if (token === 9) { recordModuleName(); return true; } diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index fa4a7c7f25f..521ff227791 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -16646,7 +16646,9 @@ var ts; } ts.isExternalModule = isExternalModule; function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { - return IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); + var newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); + newSourceFile.flags |= (sourceFile.flags & 524288); + return newSourceFile; } ts.updateSourceFile = updateSourceFile; function parseIsolatedJSDocComment(content, start, length) { @@ -51553,14 +51555,14 @@ var ts; } function visitImportCallExpression(node) { switch (compilerOptions.module) { - case ts.ModuleKind.CommonJS: - return transformImportCallExpressionCommonJS(node); case ts.ModuleKind.AMD: return transformImportCallExpressionAMD(node); case ts.ModuleKind.UMD: return transformImportCallExpressionUMD(node); + case ts.ModuleKind.CommonJS: + default: + return transformImportCallExpressionCommonJS(node); } - ts.Debug.fail("All supported module kind in this transformation step should have been handled"); } function transformImportCallExpressionUMD(node) { needUMDDynamicImportHelper = true; @@ -67631,7 +67633,14 @@ var ts; var token = ts.scanner.getToken(); if (token === 91) { token = nextToken(); - if (token === 9) { + if (token === 19) { + token = nextToken(); + if (token === 9) { + recordModuleName(); + return true; + } + } + else if (token === 9) { recordModuleName(); return true; } diff --git a/lib/typescript.js b/lib/typescript.js index 9f9a03eac7d..ad8389377c0 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -16301,7 +16301,11 @@ var ts; // becoming detached from any SourceFile). It is recommended that this SourceFile not // be used once 'update' is called on it. function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { - return IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); + var newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); + // Because new source file node is created, it may not have the flag PossiblyContainDynamicImport. This is the case if there is no new edit to add dynamic import. + // We will manually port the flag to the new source file. + newSourceFile.flags |= (sourceFile.flags & 524288 /* PossiblyContainDynamicImport */); + return newSourceFile; } ts.updateSourceFile = updateSourceFile; /* @internal */ @@ -61069,14 +61073,14 @@ var ts; } function visitImportCallExpression(node) { switch (compilerOptions.module) { - case ts.ModuleKind.CommonJS: - return transformImportCallExpressionCommonJS(node); case ts.ModuleKind.AMD: return transformImportCallExpressionAMD(node); case ts.ModuleKind.UMD: return transformImportCallExpressionUMD(node); + case ts.ModuleKind.CommonJS: + default: + return transformImportCallExpressionCommonJS(node); } - ts.Debug.fail("All supported module kind in this transformation step should have been handled"); } function transformImportCallExpressionUMD(node) { // (function (factory) { @@ -81521,7 +81525,15 @@ var ts; var token = ts.scanner.getToken(); if (token === 91 /* ImportKeyword */) { token = nextToken(); - if (token === 9 /* StringLiteral */) { + if (token === 19 /* OpenParenToken */) { + token = nextToken(); + if (token === 9 /* StringLiteral */) { + // import("mod"); + recordModuleName(); + return true; + } + } + else if (token === 9 /* StringLiteral */) { // import "mod"; recordModuleName(); return true; @@ -81705,7 +81717,7 @@ var ts; // import * as NS from "mod" // import d, {a, b as B} from "mod" // import i = require("mod"); - // + // import("mod"); // export * from "mod" // export {a as b} from "mod" // export import i = require("mod") diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 9f9a03eac7d..ad8389377c0 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -16301,7 +16301,11 @@ var ts; // becoming detached from any SourceFile). It is recommended that this SourceFile not // be used once 'update' is called on it. function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { - return IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); + var newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); + // Because new source file node is created, it may not have the flag PossiblyContainDynamicImport. This is the case if there is no new edit to add dynamic import. + // We will manually port the flag to the new source file. + newSourceFile.flags |= (sourceFile.flags & 524288 /* PossiblyContainDynamicImport */); + return newSourceFile; } ts.updateSourceFile = updateSourceFile; /* @internal */ @@ -61069,14 +61073,14 @@ var ts; } function visitImportCallExpression(node) { switch (compilerOptions.module) { - case ts.ModuleKind.CommonJS: - return transformImportCallExpressionCommonJS(node); case ts.ModuleKind.AMD: return transformImportCallExpressionAMD(node); case ts.ModuleKind.UMD: return transformImportCallExpressionUMD(node); + case ts.ModuleKind.CommonJS: + default: + return transformImportCallExpressionCommonJS(node); } - ts.Debug.fail("All supported module kind in this transformation step should have been handled"); } function transformImportCallExpressionUMD(node) { // (function (factory) { @@ -81521,7 +81525,15 @@ var ts; var token = ts.scanner.getToken(); if (token === 91 /* ImportKeyword */) { token = nextToken(); - if (token === 9 /* StringLiteral */) { + if (token === 19 /* OpenParenToken */) { + token = nextToken(); + if (token === 9 /* StringLiteral */) { + // import("mod"); + recordModuleName(); + return true; + } + } + else if (token === 9 /* StringLiteral */) { // import "mod"; recordModuleName(); return true; @@ -81705,7 +81717,7 @@ var ts; // import * as NS from "mod" // import d, {a, b as B} from "mod" // import i = require("mod"); - // + // import("mod"); // export * from "mod" // export {a as b} from "mod" // export import i = require("mod")