Skip to content

Commit

Permalink
Update LKG
Browse files Browse the repository at this point in the history
  • Loading branch information
TypeScript Bot committed Sep 18, 2020
1 parent 1dde4bb commit 2eb5dea
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 46 deletions.
12 changes: 7 additions & 5 deletions lib/tsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3836,6 +3836,8 @@ var ts;
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
}
function fileSystemEntryExists(path, entryKind) {
var originalStackTraceLimit = Error.stackTraceLimit;
Error.stackTraceLimit = 0;
try {
var stat = _fs.statSync(path);
switch (entryKind) {
Expand All @@ -3847,6 +3849,9 @@ var ts;
catch (e) {
return false;
}
finally {
Error.stackTraceLimit = originalStackTraceLimit;
}
}
function fileExists(path) {
return fileSystemEntryExists(path, 0);
Expand Down Expand Up @@ -58916,13 +58921,10 @@ var ts;
function checkTupleType(node) {
var elementTypes = node.elements;
var seenOptionalElement = false;
var seenNamedElement = false;
var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember);
for (var i = 0; i < elementTypes.length; i++) {
var e = elementTypes[i];
if (e.kind === 191) {
seenNamedElement = true;
}
else if (seenNamedElement) {
if (e.kind !== 191 && hasNamedElement) {
grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
break;
}
Expand Down
27 changes: 18 additions & 9 deletions lib/tsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -6174,6 +6174,10 @@ var ts;
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
}
function fileSystemEntryExists(path, entryKind) {
// Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
// the CPU time performance.
var originalStackTraceLimit = Error.stackTraceLimit;
Error.stackTraceLimit = 0;
try {
var stat = _fs.statSync(path);
switch (entryKind) {
Expand All @@ -6185,6 +6189,9 @@ var ts;
catch (e) {
return false;
}
finally {
Error.stackTraceLimit = originalStackTraceLimit;
}
}
function fileExists(path) {
return fileSystemEntryExists(path, 0 /* File */);
Expand Down Expand Up @@ -70542,13 +70549,10 @@ var ts;
function checkTupleType(node) {
var elementTypes = node.elements;
var seenOptionalElement = false;
var seenNamedElement = false;
var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember);
for (var i = 0; i < elementTypes.length; i++) {
var e = elementTypes[i];
if (e.kind === 191 /* NamedTupleMember */) {
seenNamedElement = true;
}
else if (seenNamedElement) {
if (e.kind !== 191 /* NamedTupleMember */ && hasNamedElement) {
grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
break;
}
Expand Down Expand Up @@ -112398,7 +112402,10 @@ var ts;
var newImport = sortedNewImports_1[_i];
var insertionIndex = ts.OrganizeImports.getImportDeclarationInsertionIndex(existingImportStatements, newImport);
if (insertionIndex === 0) {
changes.insertNodeBefore(sourceFile, existingImportStatements[0], newImport, /*blankLineBetween*/ false);
// If the first import is top-of-file, insert after the leading comment which is likely the header.
var options = existingImportStatements[0] === sourceFile.statements[0] ?
{ leadingTriviaOption: ts.textChanges.LeadingTriviaOption.Exclude } : {};
changes.insertNodeBefore(sourceFile, existingImportStatements[0], newImport, /*blankLineBetween*/ false, options);
}
else {
var prevImport = existingImportStatements[insertionIndex - 1];
Expand Down Expand Up @@ -129526,9 +129533,10 @@ var ts;
this.insertNodeAt(sourceFile, parameters.pos, newParam);
}
};
ChangeTracker.prototype.insertNodeBefore = function (sourceFile, before, newNode, blankLineBetween) {
ChangeTracker.prototype.insertNodeBefore = function (sourceFile, before, newNode, blankLineBetween, options) {
if (blankLineBetween === void 0) { blankLineBetween = false; }
this.insertNodeAt(sourceFile, getAdjustedStartPosition(sourceFile, before, {}), newNode, this.getOptionsForInsertNodeBefore(before, newNode, blankLineBetween));
if (options === void 0) { options = {}; }
this.insertNodeAt(sourceFile, getAdjustedStartPosition(sourceFile, before, options), newNode, this.getOptionsForInsertNodeBefore(before, newNode, blankLineBetween));
};
ChangeTracker.prototype.insertModifierBefore = function (sourceFile, modifier, before) {
var pos = before.getStart(sourceFile);
Expand Down Expand Up @@ -133396,7 +133404,7 @@ var ts;
else if (existingSpecifiers === null || existingSpecifiers === void 0 ? void 0 : existingSpecifiers.length) {
for (var _b = 0, newSpecifiers_2 = newSpecifiers; _b < newSpecifiers_2.length; _b++) {
var spec = newSpecifiers_2[_b];
changes.insertNodeAtEndOfList(sourceFile, existingSpecifiers, spec);
changes.insertNodeInListAfter(sourceFile, ts.last(existingSpecifiers), spec, existingSpecifiers);
}
}
else {
Expand Down Expand Up @@ -154869,6 +154877,7 @@ var ts;
kind: item.kind,
kindModifiers: item.kindModifiers,
file: item.file,
containerName: item.containerName,
span: toProtocolTextSpan(item.span, scriptInfo),
selectionSpan: toProtocolTextSpan(item.selectionSpan, scriptInfo)
};
Expand Down
27 changes: 18 additions & 9 deletions lib/tsserverlibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -6368,6 +6368,10 @@ var ts;
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
}
function fileSystemEntryExists(path, entryKind) {
// Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
// the CPU time performance.
var originalStackTraceLimit = Error.stackTraceLimit;
Error.stackTraceLimit = 0;
try {
var stat = _fs.statSync(path);
switch (entryKind) {
Expand All @@ -6379,6 +6383,9 @@ var ts;
catch (e) {
return false;
}
finally {
Error.stackTraceLimit = originalStackTraceLimit;
}
}
function fileExists(path) {
return fileSystemEntryExists(path, 0 /* File */);
Expand Down Expand Up @@ -70736,13 +70743,10 @@ var ts;
function checkTupleType(node) {
var elementTypes = node.elements;
var seenOptionalElement = false;
var seenNamedElement = false;
var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember);
for (var i = 0; i < elementTypes.length; i++) {
var e = elementTypes[i];
if (e.kind === 191 /* NamedTupleMember */) {
seenNamedElement = true;
}
else if (seenNamedElement) {
if (e.kind !== 191 /* NamedTupleMember */ && hasNamedElement) {
grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
break;
}
Expand Down Expand Up @@ -112965,7 +112969,10 @@ var ts;
var newImport = sortedNewImports_1[_i];
var insertionIndex = ts.OrganizeImports.getImportDeclarationInsertionIndex(existingImportStatements, newImport);
if (insertionIndex === 0) {
changes.insertNodeBefore(sourceFile, existingImportStatements[0], newImport, /*blankLineBetween*/ false);
// If the first import is top-of-file, insert after the leading comment which is likely the header.
var options = existingImportStatements[0] === sourceFile.statements[0] ?
{ leadingTriviaOption: ts.textChanges.LeadingTriviaOption.Exclude } : {};
changes.insertNodeBefore(sourceFile, existingImportStatements[0], newImport, /*blankLineBetween*/ false, options);
}
else {
var prevImport = existingImportStatements[insertionIndex - 1];
Expand Down Expand Up @@ -130093,9 +130100,10 @@ var ts;
this.insertNodeAt(sourceFile, parameters.pos, newParam);
}
};
ChangeTracker.prototype.insertNodeBefore = function (sourceFile, before, newNode, blankLineBetween) {
ChangeTracker.prototype.insertNodeBefore = function (sourceFile, before, newNode, blankLineBetween, options) {
if (blankLineBetween === void 0) { blankLineBetween = false; }
this.insertNodeAt(sourceFile, getAdjustedStartPosition(sourceFile, before, {}), newNode, this.getOptionsForInsertNodeBefore(before, newNode, blankLineBetween));
if (options === void 0) { options = {}; }
this.insertNodeAt(sourceFile, getAdjustedStartPosition(sourceFile, before, options), newNode, this.getOptionsForInsertNodeBefore(before, newNode, blankLineBetween));
};
ChangeTracker.prototype.insertModifierBefore = function (sourceFile, modifier, before) {
var pos = before.getStart(sourceFile);
Expand Down Expand Up @@ -133963,7 +133971,7 @@ var ts;
else if (existingSpecifiers === null || existingSpecifiers === void 0 ? void 0 : existingSpecifiers.length) {
for (var _b = 0, newSpecifiers_2 = newSpecifiers; _b < newSpecifiers_2.length; _b++) {
var spec = newSpecifiers_2[_b];
changes.insertNodeAtEndOfList(sourceFile, existingSpecifiers, spec);
changes.insertNodeInListAfter(sourceFile, ts.last(existingSpecifiers), spec, existingSpecifiers);
}
}
else {
Expand Down Expand Up @@ -155063,6 +155071,7 @@ var ts;
kind: item.kind,
kindModifiers: item.kindModifiers,
file: item.file,
containerName: item.containerName,
span: toProtocolTextSpan(item.span, scriptInfo),
selectionSpan: toProtocolTextSpan(item.selectionSpan, scriptInfo)
};
Expand Down
26 changes: 17 additions & 9 deletions lib/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -6368,6 +6368,10 @@ var ts;
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
}
function fileSystemEntryExists(path, entryKind) {
// Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
// the CPU time performance.
var originalStackTraceLimit = Error.stackTraceLimit;
Error.stackTraceLimit = 0;
try {
var stat = _fs.statSync(path);
switch (entryKind) {
Expand All @@ -6379,6 +6383,9 @@ var ts;
catch (e) {
return false;
}
finally {
Error.stackTraceLimit = originalStackTraceLimit;
}
}
function fileExists(path) {
return fileSystemEntryExists(path, 0 /* File */);
Expand Down Expand Up @@ -70736,13 +70743,10 @@ var ts;
function checkTupleType(node) {
var elementTypes = node.elements;
var seenOptionalElement = false;
var seenNamedElement = false;
var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember);
for (var i = 0; i < elementTypes.length; i++) {
var e = elementTypes[i];
if (e.kind === 191 /* NamedTupleMember */) {
seenNamedElement = true;
}
else if (seenNamedElement) {
if (e.kind !== 191 /* NamedTupleMember */ && hasNamedElement) {
grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
break;
}
Expand Down Expand Up @@ -112965,7 +112969,10 @@ var ts;
var newImport = sortedNewImports_1[_i];
var insertionIndex = ts.OrganizeImports.getImportDeclarationInsertionIndex(existingImportStatements, newImport);
if (insertionIndex === 0) {
changes.insertNodeBefore(sourceFile, existingImportStatements[0], newImport, /*blankLineBetween*/ false);
// If the first import is top-of-file, insert after the leading comment which is likely the header.
var options = existingImportStatements[0] === sourceFile.statements[0] ?
{ leadingTriviaOption: ts.textChanges.LeadingTriviaOption.Exclude } : {};
changes.insertNodeBefore(sourceFile, existingImportStatements[0], newImport, /*blankLineBetween*/ false, options);
}
else {
var prevImport = existingImportStatements[insertionIndex - 1];
Expand Down Expand Up @@ -130093,9 +130100,10 @@ var ts;
this.insertNodeAt(sourceFile, parameters.pos, newParam);
}
};
ChangeTracker.prototype.insertNodeBefore = function (sourceFile, before, newNode, blankLineBetween) {
ChangeTracker.prototype.insertNodeBefore = function (sourceFile, before, newNode, blankLineBetween, options) {
if (blankLineBetween === void 0) { blankLineBetween = false; }
this.insertNodeAt(sourceFile, getAdjustedStartPosition(sourceFile, before, {}), newNode, this.getOptionsForInsertNodeBefore(before, newNode, blankLineBetween));
if (options === void 0) { options = {}; }
this.insertNodeAt(sourceFile, getAdjustedStartPosition(sourceFile, before, options), newNode, this.getOptionsForInsertNodeBefore(before, newNode, blankLineBetween));
};
ChangeTracker.prototype.insertModifierBefore = function (sourceFile, modifier, before) {
var pos = before.getStart(sourceFile);
Expand Down Expand Up @@ -133963,7 +133971,7 @@ var ts;
else if (existingSpecifiers === null || existingSpecifiers === void 0 ? void 0 : existingSpecifiers.length) {
for (var _b = 0, newSpecifiers_2 = newSpecifiers; _b < newSpecifiers_2.length; _b++) {
var spec = newSpecifiers_2[_b];
changes.insertNodeAtEndOfList(sourceFile, existingSpecifiers, spec);
changes.insertNodeInListAfter(sourceFile, ts.last(existingSpecifiers), spec, existingSpecifiers);
}
}
else {
Expand Down
26 changes: 17 additions & 9 deletions lib/typescriptServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -6368,6 +6368,10 @@ var ts;
return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
}
function fileSystemEntryExists(path, entryKind) {
// Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
// the CPU time performance.
var originalStackTraceLimit = Error.stackTraceLimit;
Error.stackTraceLimit = 0;
try {
var stat = _fs.statSync(path);
switch (entryKind) {
Expand All @@ -6379,6 +6383,9 @@ var ts;
catch (e) {
return false;
}
finally {
Error.stackTraceLimit = originalStackTraceLimit;
}
}
function fileExists(path) {
return fileSystemEntryExists(path, 0 /* File */);
Expand Down Expand Up @@ -70736,13 +70743,10 @@ var ts;
function checkTupleType(node) {
var elementTypes = node.elements;
var seenOptionalElement = false;
var seenNamedElement = false;
var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember);
for (var i = 0; i < elementTypes.length; i++) {
var e = elementTypes[i];
if (e.kind === 191 /* NamedTupleMember */) {
seenNamedElement = true;
}
else if (seenNamedElement) {
if (e.kind !== 191 /* NamedTupleMember */ && hasNamedElement) {
grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
break;
}
Expand Down Expand Up @@ -112965,7 +112969,10 @@ var ts;
var newImport = sortedNewImports_1[_i];
var insertionIndex = ts.OrganizeImports.getImportDeclarationInsertionIndex(existingImportStatements, newImport);
if (insertionIndex === 0) {
changes.insertNodeBefore(sourceFile, existingImportStatements[0], newImport, /*blankLineBetween*/ false);
// If the first import is top-of-file, insert after the leading comment which is likely the header.
var options = existingImportStatements[0] === sourceFile.statements[0] ?
{ leadingTriviaOption: ts.textChanges.LeadingTriviaOption.Exclude } : {};
changes.insertNodeBefore(sourceFile, existingImportStatements[0], newImport, /*blankLineBetween*/ false, options);
}
else {
var prevImport = existingImportStatements[insertionIndex - 1];
Expand Down Expand Up @@ -130093,9 +130100,10 @@ var ts;
this.insertNodeAt(sourceFile, parameters.pos, newParam);
}
};
ChangeTracker.prototype.insertNodeBefore = function (sourceFile, before, newNode, blankLineBetween) {
ChangeTracker.prototype.insertNodeBefore = function (sourceFile, before, newNode, blankLineBetween, options) {
if (blankLineBetween === void 0) { blankLineBetween = false; }
this.insertNodeAt(sourceFile, getAdjustedStartPosition(sourceFile, before, {}), newNode, this.getOptionsForInsertNodeBefore(before, newNode, blankLineBetween));
if (options === void 0) { options = {}; }
this.insertNodeAt(sourceFile, getAdjustedStartPosition(sourceFile, before, options), newNode, this.getOptionsForInsertNodeBefore(before, newNode, blankLineBetween));
};
ChangeTracker.prototype.insertModifierBefore = function (sourceFile, modifier, before) {
var pos = before.getStart(sourceFile);
Expand Down Expand Up @@ -133963,7 +133971,7 @@ var ts;
else if (existingSpecifiers === null || existingSpecifiers === void 0 ? void 0 : existingSpecifiers.length) {
for (var _b = 0, newSpecifiers_2 = newSpecifiers; _b < newSpecifiers_2.length; _b++) {
var spec = newSpecifiers_2[_b];
changes.insertNodeAtEndOfList(sourceFile, existingSpecifiers, spec);
changes.insertNodeInListAfter(sourceFile, ts.last(existingSpecifiers), spec, existingSpecifiers);
}
}
else {
Expand Down
Loading

0 comments on commit 2eb5dea

Please sign in to comment.