Skip to content

Commit e321859

Browse files
committed
Update LKG
1 parent 0676f79 commit e321859

File tree

4 files changed

+47
-47
lines changed

4 files changed

+47
-47
lines changed

lib/tsc.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19263,9 +19263,12 @@ var ts;
1926319263
if (promiseType === unknownType && compilerOptions.isolatedModules) {
1926419264
return unknownType;
1926519265
}
19266-
var promiseConstructor = getMergedSymbol(promiseType.symbol);
19266+
var promiseConstructor = getNodeLinks(node.type).resolvedSymbol;
1926719267
if (!promiseConstructor || !symbolIsValue(promiseConstructor)) {
19268-
error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeToString(promiseType));
19268+
var typeName = promiseConstructor
19269+
? symbolToString(promiseConstructor)
19270+
: typeToString(promiseType);
19271+
error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName);
1926919272
return unknownType;
1927019273
}
1927119274
var promiseConstructorType = getTypeOfSymbol(promiseConstructor);

lib/tsserver.js

Lines changed: 32 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -19726,9 +19726,12 @@ var ts;
1972619726
if (promiseType === unknownType && compilerOptions.isolatedModules) {
1972719727
return unknownType;
1972819728
}
19729-
var promiseConstructor = getMergedSymbol(promiseType.symbol);
19729+
var promiseConstructor = getNodeLinks(node.type).resolvedSymbol;
1973019730
if (!promiseConstructor || !symbolIsValue(promiseConstructor)) {
19731-
error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeToString(promiseType));
19731+
var typeName = promiseConstructor
19732+
? symbolToString(promiseConstructor)
19733+
: typeToString(promiseType);
19734+
error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName);
1973219735
return unknownType;
1973319736
}
1973419737
var promiseConstructorType = getTypeOfSymbol(promiseConstructor);
@@ -42342,9 +42345,10 @@ var ts;
4234242345
this.host = host;
4234342346
this.project = project;
4234442347
this.ls = null;
42345-
this.filenameToScript = {};
4234642348
this.roots = [];
42347-
this.resolvedModuleNames = ts.createFileMap(ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames));
42349+
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);
42350+
this.resolvedModuleNames = ts.createFileMap(getCanonicalFileName);
42351+
this.filenameToScript = ts.createFileMap(getCanonicalFileName);
4234842352
this.moduleResolutionHost = {
4234942353
fileExists: function (fileName) { return _this.fileExists(fileName); },
4235042354
readFile: function (fileName) { return _this.host.readFile(fileName); }
@@ -42423,33 +42427,29 @@ var ts;
4242342427
};
4242442428
LSHost.prototype.removeReferencedFile = function (info) {
4242542429
if (!info.isOpen) {
42426-
this.filenameToScript[info.fileName] = undefined;
42430+
this.filenameToScript.remove(info.fileName);
4242742431
this.resolvedModuleNames.remove(info.fileName);
4242842432
}
4242942433
};
4243042434
LSHost.prototype.getScriptInfo = function (filename) {
42431-
var scriptInfo = ts.lookUp(this.filenameToScript, filename);
42435+
var scriptInfo = this.filenameToScript.get(filename);
4243242436
if (!scriptInfo) {
4243342437
scriptInfo = this.project.openReferencedFile(filename);
4243442438
if (scriptInfo) {
42435-
this.filenameToScript[scriptInfo.fileName] = scriptInfo;
42439+
this.filenameToScript.set(scriptInfo.fileName, scriptInfo);
4243642440
}
4243742441
}
42438-
else {
42439-
}
4244042442
return scriptInfo;
4244142443
};
4244242444
LSHost.prototype.addRoot = function (info) {
42443-
var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName);
42444-
if (!scriptInfo) {
42445-
this.filenameToScript[info.fileName] = info;
42445+
if (!this.filenameToScript.contains(info.fileName)) {
42446+
this.filenameToScript.set(info.fileName, info);
4244642447
this.roots.push(info);
4244742448
}
4244842449
};
4244942450
LSHost.prototype.removeRoot = function (info) {
42450-
var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName);
42451-
if (scriptInfo) {
42452-
this.filenameToScript[info.fileName] = undefined;
42451+
if (!this.filenameToScript.contains(info.fileName)) {
42452+
this.filenameToScript.remove(info.fileName);
4245342453
this.roots = copyListRemovingItem(info, this.roots);
4245442454
this.resolvedModuleNames.remove(info.fileName);
4245542455
}
@@ -42489,7 +42489,7 @@ var ts;
4248942489
return this.host.directoryExists(path);
4249042490
};
4249142491
LSHost.prototype.lineToTextSpan = function (filename, line) {
42492-
var script = this.filenameToScript[filename];
42492+
var script = this.filenameToScript.get(filename);
4249342493
var index = script.snap().index;
4249442494
var lineInfo = index.lineNumberToInfo(line + 1);
4249542495
var len;
@@ -42503,13 +42503,13 @@ var ts;
4250342503
return ts.createTextSpan(lineInfo.offset, len);
4250442504
};
4250542505
LSHost.prototype.lineOffsetToPosition = function (filename, line, offset) {
42506-
var script = this.filenameToScript[filename];
42506+
var script = this.filenameToScript.get(filename);
4250742507
var index = script.snap().index;
4250842508
var lineInfo = index.lineNumberToInfo(line);
4250942509
return (lineInfo.offset + offset - 1);
4251042510
};
4251142511
LSHost.prototype.positionToLineOffset = function (filename, position) {
42512-
var script = this.filenameToScript[filename];
42512+
var script = this.filenameToScript.get(filename);
4251342513
var index = script.snap().index;
4251442514
var lineOffset = index.charOffsetToLineNumberAndPos(position);
4251542515
return { line: lineOffset.line, offset: lineOffset.offset + 1 };
@@ -44295,32 +44295,23 @@ var ts;
4429544295
}
4429644296
var logger = createLoggerFromEnv();
4429744297
var pending = [];
44298-
function queueMessage(s) {
44299-
pending.push(s);
44300-
if (pending.length === 1) {
44301-
drain();
44298+
var canWrite = true;
44299+
function writeMessage(s) {
44300+
if (!canWrite) {
44301+
pending.push(s);
44302+
}
44303+
else {
44304+
canWrite = false;
44305+
process.stdout.write(new Buffer(s, "utf8"), setCanWriteFlagAndWriteMessageIfNecessary);
4430244306
}
4430344307
}
44304-
function drain() {
44305-
ts.Debug.assert(pending.length > 0);
44306-
writeBuffer(new Buffer(pending[0], "utf8"), 0);
44307-
}
44308-
function writeBuffer(buffer, offset) {
44309-
var toWrite = buffer.length - offset;
44310-
fs.write(1, buffer, offset, toWrite, undefined, function (err, written, buffer) {
44311-
if (toWrite > written) {
44312-
writeBuffer(buffer, offset + written);
44313-
}
44314-
else {
44315-
ts.Debug.assert(pending.length > 0);
44316-
pending.shift();
44317-
if (pending.length > 0) {
44318-
drain();
44319-
}
44320-
}
44321-
});
44308+
function setCanWriteFlagAndWriteMessageIfNecessary() {
44309+
canWrite = true;
44310+
if (pending.length) {
44311+
writeMessage(pending.shift());
44312+
}
4432244313
}
44323-
ts.sys.write = function (s) { return queueMessage(s); };
44314+
ts.sys.write = function (s) { return writeMessage(s); };
4432444315
var ioSession = new IOSession(ts.sys, logger);
4432544316
process.on('uncaughtException', function (err) {
4432644317
ioSession.logError(err, "unknown");

lib/typescript.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23784,9 +23784,12 @@ var ts;
2378423784
// type as a value. As such, we will just return unknownType;
2378523785
return unknownType;
2378623786
}
23787-
var promiseConstructor = getMergedSymbol(promiseType.symbol);
23787+
var promiseConstructor = getNodeLinks(node.type).resolvedSymbol;
2378823788
if (!promiseConstructor || !symbolIsValue(promiseConstructor)) {
23789-
error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeToString(promiseType));
23789+
var typeName = promiseConstructor
23790+
? symbolToString(promiseConstructor)
23791+
: typeToString(promiseType);
23792+
error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName);
2379023793
return unknownType;
2379123794
}
2379223795
// Validate the promise constructor type.

lib/typescriptServices.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23784,9 +23784,12 @@ var ts;
2378423784
// type as a value. As such, we will just return unknownType;
2378523785
return unknownType;
2378623786
}
23787-
var promiseConstructor = getMergedSymbol(promiseType.symbol);
23787+
var promiseConstructor = getNodeLinks(node.type).resolvedSymbol;
2378823788
if (!promiseConstructor || !symbolIsValue(promiseConstructor)) {
23789-
error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeToString(promiseType));
23789+
var typeName = promiseConstructor
23790+
? symbolToString(promiseConstructor)
23791+
: typeToString(promiseType);
23792+
error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName);
2379023793
return unknownType;
2379123794
}
2379223795
// Validate the promise constructor type.

0 commit comments

Comments
 (0)