From e3218591d2286d56523f0096edb7c73f364096eb Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 28 Oct 2015 14:16:44 -0700 Subject: [PATCH] Update LKG --- lib/tsc.js | 7 ++-- lib/tsserver.js | 73 +++++++++++++++++---------------------- lib/typescript.js | 7 ++-- lib/typescriptServices.js | 7 ++-- 4 files changed, 47 insertions(+), 47 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index d412ef7a92d..96764269d7d 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -19263,9 +19263,12 @@ var ts; if (promiseType === unknownType && compilerOptions.isolatedModules) { return unknownType; } - var promiseConstructor = getMergedSymbol(promiseType.symbol); + var promiseConstructor = getNodeLinks(node.type).resolvedSymbol; if (!promiseConstructor || !symbolIsValue(promiseConstructor)) { - error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeToString(promiseType)); + var typeName = promiseConstructor + ? symbolToString(promiseConstructor) + : typeToString(promiseType); + error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); return unknownType; } var promiseConstructorType = getTypeOfSymbol(promiseConstructor); diff --git a/lib/tsserver.js b/lib/tsserver.js index 1b1d3b06053..c4f0a9d2d45 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -19726,9 +19726,12 @@ var ts; if (promiseType === unknownType && compilerOptions.isolatedModules) { return unknownType; } - var promiseConstructor = getMergedSymbol(promiseType.symbol); + var promiseConstructor = getNodeLinks(node.type).resolvedSymbol; if (!promiseConstructor || !symbolIsValue(promiseConstructor)) { - error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeToString(promiseType)); + var typeName = promiseConstructor + ? symbolToString(promiseConstructor) + : typeToString(promiseType); + error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); return unknownType; } var promiseConstructorType = getTypeOfSymbol(promiseConstructor); @@ -42342,9 +42345,10 @@ var ts; this.host = host; this.project = project; this.ls = null; - this.filenameToScript = {}; this.roots = []; - this.resolvedModuleNames = ts.createFileMap(ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames)); + var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); + this.resolvedModuleNames = ts.createFileMap(getCanonicalFileName); + this.filenameToScript = ts.createFileMap(getCanonicalFileName); this.moduleResolutionHost = { fileExists: function (fileName) { return _this.fileExists(fileName); }, readFile: function (fileName) { return _this.host.readFile(fileName); } @@ -42423,33 +42427,29 @@ var ts; }; LSHost.prototype.removeReferencedFile = function (info) { if (!info.isOpen) { - this.filenameToScript[info.fileName] = undefined; + this.filenameToScript.remove(info.fileName); this.resolvedModuleNames.remove(info.fileName); } }; LSHost.prototype.getScriptInfo = function (filename) { - var scriptInfo = ts.lookUp(this.filenameToScript, filename); + var scriptInfo = this.filenameToScript.get(filename); if (!scriptInfo) { scriptInfo = this.project.openReferencedFile(filename); if (scriptInfo) { - this.filenameToScript[scriptInfo.fileName] = scriptInfo; + this.filenameToScript.set(scriptInfo.fileName, scriptInfo); } } - else { - } return scriptInfo; }; LSHost.prototype.addRoot = function (info) { - var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName); - if (!scriptInfo) { - this.filenameToScript[info.fileName] = info; + if (!this.filenameToScript.contains(info.fileName)) { + this.filenameToScript.set(info.fileName, info); this.roots.push(info); } }; LSHost.prototype.removeRoot = function (info) { - var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName); - if (scriptInfo) { - this.filenameToScript[info.fileName] = undefined; + if (!this.filenameToScript.contains(info.fileName)) { + this.filenameToScript.remove(info.fileName); this.roots = copyListRemovingItem(info, this.roots); this.resolvedModuleNames.remove(info.fileName); } @@ -42489,7 +42489,7 @@ var ts; return this.host.directoryExists(path); }; LSHost.prototype.lineToTextSpan = function (filename, line) { - var script = this.filenameToScript[filename]; + var script = this.filenameToScript.get(filename); var index = script.snap().index; var lineInfo = index.lineNumberToInfo(line + 1); var len; @@ -42503,13 +42503,13 @@ var ts; return ts.createTextSpan(lineInfo.offset, len); }; LSHost.prototype.lineOffsetToPosition = function (filename, line, offset) { - var script = this.filenameToScript[filename]; + var script = this.filenameToScript.get(filename); var index = script.snap().index; var lineInfo = index.lineNumberToInfo(line); return (lineInfo.offset + offset - 1); }; LSHost.prototype.positionToLineOffset = function (filename, position) { - var script = this.filenameToScript[filename]; + var script = this.filenameToScript.get(filename); var index = script.snap().index; var lineOffset = index.charOffsetToLineNumberAndPos(position); return { line: lineOffset.line, offset: lineOffset.offset + 1 }; @@ -44295,32 +44295,23 @@ var ts; } var logger = createLoggerFromEnv(); var pending = []; - function queueMessage(s) { - pending.push(s); - if (pending.length === 1) { - drain(); + var canWrite = true; + function writeMessage(s) { + if (!canWrite) { + pending.push(s); + } + else { + canWrite = false; + process.stdout.write(new Buffer(s, "utf8"), setCanWriteFlagAndWriteMessageIfNecessary); } } - function drain() { - ts.Debug.assert(pending.length > 0); - writeBuffer(new Buffer(pending[0], "utf8"), 0); + function setCanWriteFlagAndWriteMessageIfNecessary() { + canWrite = true; + if (pending.length) { + writeMessage(pending.shift()); + } } - function writeBuffer(buffer, offset) { - var toWrite = buffer.length - offset; - fs.write(1, buffer, offset, toWrite, undefined, function (err, written, buffer) { - if (toWrite > written) { - writeBuffer(buffer, offset + written); - } - else { - ts.Debug.assert(pending.length > 0); - pending.shift(); - if (pending.length > 0) { - drain(); - } - } - }); - } - ts.sys.write = function (s) { return queueMessage(s); }; + ts.sys.write = function (s) { return writeMessage(s); }; var ioSession = new IOSession(ts.sys, logger); process.on('uncaughtException', function (err) { ioSession.logError(err, "unknown"); diff --git a/lib/typescript.js b/lib/typescript.js index d0f7741df2c..d3b40cc962e 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -23784,9 +23784,12 @@ var ts; // type as a value. As such, we will just return unknownType; return unknownType; } - var promiseConstructor = getMergedSymbol(promiseType.symbol); + var promiseConstructor = getNodeLinks(node.type).resolvedSymbol; if (!promiseConstructor || !symbolIsValue(promiseConstructor)) { - error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeToString(promiseType)); + var typeName = promiseConstructor + ? symbolToString(promiseConstructor) + : typeToString(promiseType); + error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); return unknownType; } // Validate the promise constructor type. diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index d0f7741df2c..d3b40cc962e 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -23784,9 +23784,12 @@ var ts; // type as a value. As such, we will just return unknownType; return unknownType; } - var promiseConstructor = getMergedSymbol(promiseType.symbol); + var promiseConstructor = getNodeLinks(node.type).resolvedSymbol; if (!promiseConstructor || !symbolIsValue(promiseConstructor)) { - error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeToString(promiseType)); + var typeName = promiseConstructor + ? symbolToString(promiseConstructor) + : typeToString(promiseType); + error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); return unknownType; } // Validate the promise constructor type.