From a1ff917aa2ad10507673bebd2a61b669ad839eaf Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Fri, 20 Nov 2015 14:33:31 -0800 Subject: [PATCH] Update LKG --- lib/tsc.js | 10 ++++++---- lib/tsserver.js | 27 ++++++++++++++++----------- lib/typescript.js | 15 ++++++++++----- lib/typescriptServices.js | 15 ++++++++++----- 4 files changed, 42 insertions(+), 25 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index aa9bce7eb6c8c..a7184cc747eef 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -19016,10 +19016,12 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 143 || node.kind === 142); - ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); - var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; - error(errorNode_1, diagnostic); + var reportError = (node.kind === 143 || node.kind === 142) && + (node.flags & 128) !== (subsequentNode.flags & 128); + if (reportError) { + var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + error(errorNode_1, diagnostic); + } return; } else if (ts.nodeIsPresent(subsequentNode.body)) { diff --git a/lib/tsserver.js b/lib/tsserver.js index 0ee8d49430b7a..8daef4bfd88e7 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -19479,10 +19479,12 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 143 || node.kind === 142); - ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); - var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; - error(errorNode_1, diagnostic); + var reportError = (node.kind === 143 || node.kind === 142) && + (node.flags & 128) !== (subsequentNode.flags & 128); + if (reportError) { + var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + error(errorNode_1, diagnostic); + } return; } else if (ts.nodeIsPresent(subsequentNode.body)) { @@ -41443,7 +41445,7 @@ var ts; }, _a[CommandNames.Open] = function (request) { var openArgs = request.arguments; - _this.openClientFile(openArgs.file); + _this.openClientFile(openArgs.file, openArgs.fileContent); return { responseRequired: false }; }, _a[CommandNames.Quickinfo] = function (request) { @@ -41876,9 +41878,9 @@ var ts; symbolDisplayString: displayString }; }; - Session.prototype.openClientFile = function (fileName) { + Session.prototype.openClientFile = function (fileName, fileContent) { var file = ts.normalizePath(fileName); - this.projectService.openClientFile(file); + this.projectService.openClientFile(file, fileContent); }; Session.prototype.getQuickInfo = function (line, offset, fileName) { var file = ts.normalizePath(fileName); @@ -43031,14 +43033,14 @@ var ts; filename = ts.normalizePath(filename); return ts.lookUp(this.filenameToScriptInfo, filename); }; - ProjectService.prototype.openFile = function (fileName, openedByClient) { + ProjectService.prototype.openFile = function (fileName, openedByClient, fileContent) { var _this = this; fileName = ts.normalizePath(fileName); var info = ts.lookUp(this.filenameToScriptInfo, fileName); if (!info) { var content; if (this.host.fileExists(fileName)) { - content = this.host.readFile(fileName); + content = fileContent || this.host.readFile(fileName); } if (!content) { if (openedByClient) { @@ -43056,6 +43058,9 @@ var ts; } } if (info) { + if (fileContent) { + info.svc.reload(fileContent); + } if (openedByClient) { info.isOpen = true; } @@ -43076,9 +43081,9 @@ var ts; } return undefined; }; - ProjectService.prototype.openClientFile = function (fileName) { + ProjectService.prototype.openClientFile = function (fileName, fileContent) { this.openOrUpdateConfiguredProjectForFile(fileName); - var info = this.openFile(fileName, true); + var info = this.openFile(fileName, true, fileContent); this.addOpenFile(info); this.printProjects(); return info; diff --git a/lib/typescript.js b/lib/typescript.js index c037b68b74b9a..ba0ee07bbe762 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -23384,11 +23384,16 @@ var ts; var errorNode_1 = subsequentNode.name || subsequentNode; // TODO(jfreeman): These are methods, so handle computed name case if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - // the only situation when this is possible (same kind\same name but different symbol) - mixed static and instance class members - ts.Debug.assert(node.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */); - ts.Debug.assert((node.flags & 128 /* Static */) !== (subsequentNode.flags & 128 /* Static */)); - var diagnostic = node.flags & 128 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; - error(errorNode_1, diagnostic); + var reportError = (node.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */) && + (node.flags & 128 /* Static */) !== (subsequentNode.flags & 128 /* Static */); + // we can get here in two cases + // 1. mixed static and instance class members + // 2. something with the same name was defined before the set of overloads that prevents them from merging + // here we'll report error only for the first case since for second we should already report error in binder + if (reportError) { + var diagnostic = node.flags & 128 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + error(errorNode_1, diagnostic); + } return; } else if (ts.nodeIsPresent(subsequentNode.body)) { diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index c037b68b74b9a..ba0ee07bbe762 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -23384,11 +23384,16 @@ var ts; var errorNode_1 = subsequentNode.name || subsequentNode; // TODO(jfreeman): These are methods, so handle computed name case if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - // the only situation when this is possible (same kind\same name but different symbol) - mixed static and instance class members - ts.Debug.assert(node.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */); - ts.Debug.assert((node.flags & 128 /* Static */) !== (subsequentNode.flags & 128 /* Static */)); - var diagnostic = node.flags & 128 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; - error(errorNode_1, diagnostic); + var reportError = (node.kind === 143 /* MethodDeclaration */ || node.kind === 142 /* MethodSignature */) && + (node.flags & 128 /* Static */) !== (subsequentNode.flags & 128 /* Static */); + // we can get here in two cases + // 1. mixed static and instance class members + // 2. something with the same name was defined before the set of overloads that prevents them from merging + // here we'll report error only for the first case since for second we should already report error in binder + if (reportError) { + var diagnostic = node.flags & 128 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + error(errorNode_1, diagnostic); + } return; } else if (ts.nodeIsPresent(subsequentNode.body)) {