Skip to content

Commit 0469cc6

Browse files
committed
Update LKG
1 parent 67930ea commit 0469cc6

File tree

6 files changed

+360
-18
lines changed

6 files changed

+360
-18
lines changed

lib/tsc.js

+60-3
Original file line numberDiff line numberDiff line change
@@ -74247,7 +74247,7 @@ var ts;
7424774247
}
7424874248
var diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
7424974249
if (diagnostics) {
74250-
state.semanticDiagnosticsPerFile.set(sourceFilePath, diagnostics);
74250+
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : diagnostics);
7425174251
if (!state.semanticDiagnosticsFromOldState) {
7425274252
state.semanticDiagnosticsFromOldState = ts.createMap();
7425374253
}
@@ -74268,6 +74268,31 @@ var ts;
7426874268
}
7426974269
return state;
7427074270
}
74271+
function convertToDiagnostics(diagnostics, newProgram) {
74272+
if (!diagnostics.length)
74273+
return ts.emptyArray;
74274+
return diagnostics.map(function (diagnostic) {
74275+
var result = convertToDiagnosticRelatedInformation(diagnostic, newProgram);
74276+
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
74277+
result.source = diagnostic.source;
74278+
var relatedInformation = diagnostic.relatedInformation;
74279+
result.relatedInformation = relatedInformation ?
74280+
relatedInformation.length ?
74281+
relatedInformation.map(function (r) { return convertToDiagnosticRelatedInformation(r, newProgram); }) :
74282+
ts.emptyArray :
74283+
undefined;
74284+
return result;
74285+
});
74286+
}
74287+
function convertToDiagnosticRelatedInformation(diagnostic, newProgram) {
74288+
var file = diagnostic.file, messageText = diagnostic.messageText;
74289+
return __assign({}, diagnostic, { file: file && newProgram.getSourceFileByPath(file), messageText: messageText === undefined || ts.isString(messageText) ?
74290+
messageText :
74291+
convertToDiagnosticMessageChain(messageText, newProgram) });
74292+
}
74293+
function convertToDiagnosticMessageChain(diagnostic, newProgram) {
74294+
return __assign({}, diagnostic, { next: diagnostic.next && convertToDiagnosticMessageChain(diagnostic.next, newProgram) });
74295+
}
7427174296
function releaseCache(state) {
7427274297
ts.BuilderState.releaseCache(state);
7427374298
state.program = undefined;
@@ -74494,11 +74519,42 @@ var ts;
7449474519
}
7449574520
if (state.semanticDiagnosticsPerFile) {
7449674521
var semanticDiagnosticsPerFile_1 = [];
74497-
state.semanticDiagnosticsPerFile.forEach(function (_value, key) { return semanticDiagnosticsPerFile_1.push(key); });
74522+
state.semanticDiagnosticsPerFile.forEach(function (value, key) { return semanticDiagnosticsPerFile_1.push(value.length ?
74523+
[
74524+
key,
74525+
state.hasReusableDiagnostic ?
74526+
value :
74527+
convertToReusableDiagnostics(value)
74528+
] :
74529+
key); });
7449874530
result.semanticDiagnosticsPerFile = semanticDiagnosticsPerFile_1;
7449974531
}
7450074532
return result;
7450174533
}
74534+
function convertToReusableDiagnostics(diagnostics) {
74535+
ts.Debug.assert(!!diagnostics.length);
74536+
return diagnostics.map(function (diagnostic) {
74537+
var result = convertToReusableDiagnosticRelatedInformation(diagnostic);
74538+
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
74539+
result.source = diagnostic.source;
74540+
var relatedInformation = diagnostic.relatedInformation;
74541+
result.relatedInformation = relatedInformation ?
74542+
relatedInformation.length ?
74543+
relatedInformation.map(function (r) { return convertToReusableDiagnosticRelatedInformation(r); }) :
74544+
ts.emptyArray :
74545+
undefined;
74546+
return result;
74547+
});
74548+
}
74549+
function convertToReusableDiagnosticRelatedInformation(diagnostic) {
74550+
var file = diagnostic.file, messageText = diagnostic.messageText;
74551+
return __assign({}, diagnostic, { file: file && file.path, messageText: messageText === undefined || ts.isString(messageText) ?
74552+
messageText :
74553+
convertToReusableDiagnosticMessageChain(messageText) });
74554+
}
74555+
function convertToReusableDiagnosticMessageChain(diagnostic) {
74556+
return __assign({}, diagnostic, { next: diagnostic.next && convertToReusableDiagnosticMessageChain(diagnostic.next) });
74557+
}
7450274558
var BuilderProgramKind;
7450374559
(function (BuilderProgramKind) {
7450474560
BuilderProgramKind[BuilderProgramKind["SemanticDiagnosticsBuilderProgram"] = 0] = "SemanticDiagnosticsBuilderProgram";
@@ -74701,7 +74757,8 @@ var ts;
7470174757
compilerOptions: program.options,
7470274758
referencedMap: getMapOfReferencedSet(program.referencedMap),
7470374759
exportedModulesMap: getMapOfReferencedSet(program.exportedModulesMap),
74704-
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, ts.identity, function () { return ts.emptyArray; })
74760+
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return ts.isString(value) ? value : value[0]; }, function (value) { return ts.isString(value) ? ts.emptyArray : value[1]; }),
74761+
hasReusableDiagnostic: true
7470574762
};
7470674763
return {
7470774764
getState: function () { return state; },

lib/tsserver.js

+60-3
Original file line numberDiff line numberDiff line change
@@ -90679,7 +90679,7 @@ var ts;
9067990679
// Unchanged file copy diagnostics
9068090680
var diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
9068190681
if (diagnostics) {
90682-
state.semanticDiagnosticsPerFile.set(sourceFilePath, diagnostics);
90682+
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : diagnostics);
9068390683
if (!state.semanticDiagnosticsFromOldState) {
9068490684
state.semanticDiagnosticsFromOldState = ts.createMap();
9068590685
}
@@ -90701,6 +90701,31 @@ var ts;
9070190701
}
9070290702
return state;
9070390703
}
90704+
function convertToDiagnostics(diagnostics, newProgram) {
90705+
if (!diagnostics.length)
90706+
return ts.emptyArray;
90707+
return diagnostics.map(function (diagnostic) {
90708+
var result = convertToDiagnosticRelatedInformation(diagnostic, newProgram);
90709+
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
90710+
result.source = diagnostic.source;
90711+
var relatedInformation = diagnostic.relatedInformation;
90712+
result.relatedInformation = relatedInformation ?
90713+
relatedInformation.length ?
90714+
relatedInformation.map(function (r) { return convertToDiagnosticRelatedInformation(r, newProgram); }) :
90715+
ts.emptyArray :
90716+
undefined;
90717+
return result;
90718+
});
90719+
}
90720+
function convertToDiagnosticRelatedInformation(diagnostic, newProgram) {
90721+
var file = diagnostic.file, messageText = diagnostic.messageText;
90722+
return __assign({}, diagnostic, { file: file && newProgram.getSourceFileByPath(file), messageText: messageText === undefined || ts.isString(messageText) ?
90723+
messageText :
90724+
convertToDiagnosticMessageChain(messageText, newProgram) });
90725+
}
90726+
function convertToDiagnosticMessageChain(diagnostic, newProgram) {
90727+
return __assign({}, diagnostic, { next: diagnostic.next && convertToDiagnosticMessageChain(diagnostic.next, newProgram) });
90728+
}
9070490729
/**
9070590730
* Releases program and other related not needed properties
9070690731
*/
@@ -91000,11 +91025,42 @@ var ts;
9100091025
if (state.semanticDiagnosticsPerFile) {
9100191026
var semanticDiagnosticsPerFile_1 = [];
9100291027
// Currently not recording actual errors since those mean no emit for tsc --build
91003-
state.semanticDiagnosticsPerFile.forEach(function (_value, key) { return semanticDiagnosticsPerFile_1.push(key); });
91028+
state.semanticDiagnosticsPerFile.forEach(function (value, key) { return semanticDiagnosticsPerFile_1.push(value.length ?
91029+
[
91030+
key,
91031+
state.hasReusableDiagnostic ?
91032+
value :
91033+
convertToReusableDiagnostics(value)
91034+
] :
91035+
key); });
9100491036
result.semanticDiagnosticsPerFile = semanticDiagnosticsPerFile_1;
9100591037
}
9100691038
return result;
9100791039
}
91040+
function convertToReusableDiagnostics(diagnostics) {
91041+
ts.Debug.assert(!!diagnostics.length);
91042+
return diagnostics.map(function (diagnostic) {
91043+
var result = convertToReusableDiagnosticRelatedInformation(diagnostic);
91044+
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
91045+
result.source = diagnostic.source;
91046+
var relatedInformation = diagnostic.relatedInformation;
91047+
result.relatedInformation = relatedInformation ?
91048+
relatedInformation.length ?
91049+
relatedInformation.map(function (r) { return convertToReusableDiagnosticRelatedInformation(r); }) :
91050+
ts.emptyArray :
91051+
undefined;
91052+
return result;
91053+
});
91054+
}
91055+
function convertToReusableDiagnosticRelatedInformation(diagnostic) {
91056+
var file = diagnostic.file, messageText = diagnostic.messageText;
91057+
return __assign({}, diagnostic, { file: file && file.path, messageText: messageText === undefined || ts.isString(messageText) ?
91058+
messageText :
91059+
convertToReusableDiagnosticMessageChain(messageText) });
91060+
}
91061+
function convertToReusableDiagnosticMessageChain(diagnostic) {
91062+
return __assign({}, diagnostic, { next: diagnostic.next && convertToReusableDiagnosticMessageChain(diagnostic.next) });
91063+
}
9100891064
var BuilderProgramKind;
9100991065
(function (BuilderProgramKind) {
9101091066
BuilderProgramKind[BuilderProgramKind["SemanticDiagnosticsBuilderProgram"] = 0] = "SemanticDiagnosticsBuilderProgram";
@@ -91268,7 +91324,8 @@ var ts;
9126891324
compilerOptions: program.options,
9126991325
referencedMap: getMapOfReferencedSet(program.referencedMap),
9127091326
exportedModulesMap: getMapOfReferencedSet(program.exportedModulesMap),
91271-
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, ts.identity, function () { return ts.emptyArray; })
91327+
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return ts.isString(value) ? value : value[0]; }, function (value) { return ts.isString(value) ? ts.emptyArray : value[1]; }),
91328+
hasReusableDiagnostic: true
9127291329
};
9127391330
return {
9127491331
getState: function () { return state; },

lib/tsserverlibrary.js

+60-3
Original file line numberDiff line numberDiff line change
@@ -90678,7 +90678,7 @@ var ts;
9067890678
// Unchanged file copy diagnostics
9067990679
var diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
9068090680
if (diagnostics) {
90681-
state.semanticDiagnosticsPerFile.set(sourceFilePath, diagnostics);
90681+
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : diagnostics);
9068290682
if (!state.semanticDiagnosticsFromOldState) {
9068390683
state.semanticDiagnosticsFromOldState = ts.createMap();
9068490684
}
@@ -90700,6 +90700,31 @@ var ts;
9070090700
}
9070190701
return state;
9070290702
}
90703+
function convertToDiagnostics(diagnostics, newProgram) {
90704+
if (!diagnostics.length)
90705+
return ts.emptyArray;
90706+
return diagnostics.map(function (diagnostic) {
90707+
var result = convertToDiagnosticRelatedInformation(diagnostic, newProgram);
90708+
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
90709+
result.source = diagnostic.source;
90710+
var relatedInformation = diagnostic.relatedInformation;
90711+
result.relatedInformation = relatedInformation ?
90712+
relatedInformation.length ?
90713+
relatedInformation.map(function (r) { return convertToDiagnosticRelatedInformation(r, newProgram); }) :
90714+
ts.emptyArray :
90715+
undefined;
90716+
return result;
90717+
});
90718+
}
90719+
function convertToDiagnosticRelatedInformation(diagnostic, newProgram) {
90720+
var file = diagnostic.file, messageText = diagnostic.messageText;
90721+
return __assign({}, diagnostic, { file: file && newProgram.getSourceFileByPath(file), messageText: messageText === undefined || ts.isString(messageText) ?
90722+
messageText :
90723+
convertToDiagnosticMessageChain(messageText, newProgram) });
90724+
}
90725+
function convertToDiagnosticMessageChain(diagnostic, newProgram) {
90726+
return __assign({}, diagnostic, { next: diagnostic.next && convertToDiagnosticMessageChain(diagnostic.next, newProgram) });
90727+
}
9070390728
/**
9070490729
* Releases program and other related not needed properties
9070590730
*/
@@ -90999,11 +91024,42 @@ var ts;
9099991024
if (state.semanticDiagnosticsPerFile) {
9100091025
var semanticDiagnosticsPerFile_1 = [];
9100191026
// Currently not recording actual errors since those mean no emit for tsc --build
91002-
state.semanticDiagnosticsPerFile.forEach(function (_value, key) { return semanticDiagnosticsPerFile_1.push(key); });
91027+
state.semanticDiagnosticsPerFile.forEach(function (value, key) { return semanticDiagnosticsPerFile_1.push(value.length ?
91028+
[
91029+
key,
91030+
state.hasReusableDiagnostic ?
91031+
value :
91032+
convertToReusableDiagnostics(value)
91033+
] :
91034+
key); });
9100391035
result.semanticDiagnosticsPerFile = semanticDiagnosticsPerFile_1;
9100491036
}
9100591037
return result;
9100691038
}
91039+
function convertToReusableDiagnostics(diagnostics) {
91040+
ts.Debug.assert(!!diagnostics.length);
91041+
return diagnostics.map(function (diagnostic) {
91042+
var result = convertToReusableDiagnosticRelatedInformation(diagnostic);
91043+
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
91044+
result.source = diagnostic.source;
91045+
var relatedInformation = diagnostic.relatedInformation;
91046+
result.relatedInformation = relatedInformation ?
91047+
relatedInformation.length ?
91048+
relatedInformation.map(function (r) { return convertToReusableDiagnosticRelatedInformation(r); }) :
91049+
ts.emptyArray :
91050+
undefined;
91051+
return result;
91052+
});
91053+
}
91054+
function convertToReusableDiagnosticRelatedInformation(diagnostic) {
91055+
var file = diagnostic.file, messageText = diagnostic.messageText;
91056+
return __assign({}, diagnostic, { file: file && file.path, messageText: messageText === undefined || ts.isString(messageText) ?
91057+
messageText :
91058+
convertToReusableDiagnosticMessageChain(messageText) });
91059+
}
91060+
function convertToReusableDiagnosticMessageChain(diagnostic) {
91061+
return __assign({}, diagnostic, { next: diagnostic.next && convertToReusableDiagnosticMessageChain(diagnostic.next) });
91062+
}
9100791063
var BuilderProgramKind;
9100891064
(function (BuilderProgramKind) {
9100991065
BuilderProgramKind[BuilderProgramKind["SemanticDiagnosticsBuilderProgram"] = 0] = "SemanticDiagnosticsBuilderProgram";
@@ -91267,7 +91323,8 @@ var ts;
9126791323
compilerOptions: program.options,
9126891324
referencedMap: getMapOfReferencedSet(program.referencedMap),
9126991325
exportedModulesMap: getMapOfReferencedSet(program.exportedModulesMap),
91270-
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, ts.identity, function () { return ts.emptyArray; })
91326+
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return ts.isString(value) ? value : value[0]; }, function (value) { return ts.isString(value) ? ts.emptyArray : value[1]; }),
91327+
hasReusableDiagnostic: true
9127191328
};
9127291329
return {
9127391330
getState: function () { return state; },

0 commit comments

Comments
 (0)