Update LKG

This commit is contained in:
Ron Buckton 2015-10-28 14:16:44 -07:00
parent 0676f79e28
commit e3218591d2
4 changed files with 47 additions and 47 deletions

View File

@ -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);

View File

@ -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");

View File

@ -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.

View File

@ -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.