Update LKG

This commit is contained in:
Sheetal Nandi 2019-03-05 12:58:12 -08:00
parent 6e1e1e7bd5
commit 69f65f5445
9 changed files with 534 additions and 620 deletions

View file

@ -14,7 +14,6 @@ and limitations under the License.
***************************************************************************** */
"use strict";
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
@ -42631,7 +42630,7 @@ var ts;
if (isTupleType(restType)) {
var associatedNames = restType.target.associatedNames;
var index = pos - paramCount;
return associatedNames ? associatedNames[index] : restParameter.escapedName + "_" + index;
return associatedNames && associatedNames[index] || restParameter.escapedName + "_" + index;
}
return restParameter.escapedName;
}
@ -69852,7 +69851,7 @@ var ts;
function emitCommaList(node) {
emitExpressionList(node, node.elements, 528);
}
function emitPrologueDirectives(statements, sourceFile, seenPrologueDirectives) {
function emitPrologueDirectives(statements, sourceFile, seenPrologueDirectives, recordBundleFileSection) {
var needsToSetSourceFile = !!sourceFile;
for (var i = 0; i < statements.length; i++) {
var statement = statements[i];
@ -69866,7 +69865,7 @@ var ts;
writeLine();
var pos = writer.getTextPos();
emit(statement);
if (bundleFileInfo)
if (recordBundleFileSection && bundleFileInfo)
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "prologue", data: statement.expression.text });
if (seenPrologueDirectives) {
seenPrologueDirectives.set(statement.expression.text, true);
@ -69906,7 +69905,7 @@ var ts;
}
for (var _c = 0, _d = sourceFileOrBundle.sourceFiles; _c < _d.length; _c++) {
var sourceFile = _d[_c];
emitPrologueDirectives(sourceFile.statements, sourceFile, seenPrologueDirectives);
emitPrologueDirectives(sourceFile.statements, sourceFile, seenPrologueDirectives, true);
}
setSourceFile(undefined);
}
@ -77495,7 +77494,6 @@ var ts;
}
}
})(ts || (ts = {}));
//# sourceMappingURL=compiler.release.js.map
var ts;
(function (ts) {
function countLines(program) {

View file

@ -14,31 +14,6 @@ and limitations under the License.
***************************************************************************** */
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
@ -82,6 +57,28 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
};
var ts;
(function (ts) {
// WARNING: The script `configureNightly.ts` uses a regexp to parse out these values.
@ -51064,7 +51061,7 @@ var ts;
if (isTupleType(restType)) {
var associatedNames = restType.target.associatedNames;
var index = pos - paramCount;
return associatedNames ? associatedNames[index] : restParameter.escapedName + "_" + index;
return associatedNames && associatedNames[index] || restParameter.escapedName + "_" + index;
}
return restParameter.escapedName;
}
@ -85632,7 +85629,7 @@ var ts;
* Emits any prologue directives at the start of a Statement list, returning the
* number of prologue directives written to the output.
*/
function emitPrologueDirectives(statements, sourceFile, seenPrologueDirectives) {
function emitPrologueDirectives(statements, sourceFile, seenPrologueDirectives, recordBundleFileSection) {
var needsToSetSourceFile = !!sourceFile;
for (var i = 0; i < statements.length; i++) {
var statement = statements[i];
@ -85646,7 +85643,7 @@ var ts;
writeLine();
var pos = writer.getTextPos();
emit(statement);
if (bundleFileInfo)
if (recordBundleFileSection && bundleFileInfo)
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "prologue" /* Prologue */, data: statement.expression.text });
if (seenPrologueDirectives) {
seenPrologueDirectives.set(statement.expression.text, true);
@ -85687,7 +85684,7 @@ var ts;
}
for (var _c = 0, _d = sourceFileOrBundle.sourceFiles; _c < _d.length; _c++) {
var sourceFile = _d[_c];
emitPrologueDirectives(sourceFile.statements, sourceFile, seenPrologueDirectives);
emitPrologueDirectives(sourceFile.statements, sourceFile, seenPrologueDirectives, /*recordBundleFileSection*/ true);
}
setSourceFile(undefined);
}
@ -94402,32 +94399,6 @@ var ts;
}
}
})(ts || (ts = {}));
//# sourceMappingURL=compiler.js.map
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var ts;
(function (ts) {
var ScriptSnapshot;
@ -122090,8 +122061,6 @@ var TypeScript;
// TODO: it should be moved into a namespace though.
/* @internal */
var toolsVersion = ts.versionMajorMinor;
//# sourceMappingURL=services.js.map
"use strict";
/* @internal */
var ts;
(function (ts) {
@ -122432,41 +122401,6 @@ var ts;
JsTyping.renderPackageNameValidationFailure = renderPackageNameValidationFailure;
})(JsTyping = ts.JsTyping || (ts.JsTyping = {}));
})(ts || (ts = {}));
//# sourceMappingURL=jsTyping.js.map
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
};
var ts;
(function (ts) {
var server;
@ -130295,7 +130229,6 @@ var ts;
}());
})(server = ts.server || (ts.server = {}));
})(ts || (ts = {}));
//# sourceMappingURL=server.js.map
// tslint:disable no-unnecessary-type-assertion (TODO: tslint can't find node types)
var ts;
(function (ts) {

View file

@ -422,7 +422,7 @@ declare namespace ts {
FirstJSDocNode = 288,
LastJSDocNode = 310,
FirstJSDocTagNode = 299,
LastJSDocTagNode = 310
LastJSDocTagNode = 310,
}
enum NodeFlags {
None = 0,
@ -451,7 +451,7 @@ declare namespace ts {
ReachabilityCheckFlags = 384,
ReachabilityAndEmitFlags = 1408,
ContextFlags = 12679168,
TypeExcludesFlags = 20480
TypeExcludesFlags = 20480,
}
enum ModifierFlags {
None = 0,
@ -1008,7 +1008,7 @@ declare namespace ts {
Octal = 32,
HexSpecifier = 64,
BinarySpecifier = 128,
OctalSpecifier = 256
OctalSpecifier = 256,
}
interface NumericLiteral extends LiteralExpression {
kind: SyntaxKind.NumericLiteral;
@ -2061,7 +2061,7 @@ declare namespace ts {
WriteTypeParametersOrArguments = 1,
UseOnlyExternalAliasing = 2,
AllowAnyNodeKind = 4,
UseAliasDefinedOutsideCurrentScope = 8
UseAliasDefinedOutsideCurrentScope = 8,
}
enum TypePredicateKind {
This = 0,
@ -2139,7 +2139,7 @@ declare namespace ts {
ExportHasLocal = 944,
BlockScoped = 418,
PropertyOrAccessor = 98308,
ClassMember = 106500
ClassMember = 106500,
}
interface Symbol {
flags: SymbolFlags;
@ -2247,7 +2247,7 @@ declare namespace ts {
Instantiable = 63176704,
StructuredOrInstantiable = 66846720,
Narrowable = 133970943,
NotUnionOrUnit = 67637251
NotUnionOrUnit = 67637251,
}
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
interface Type {
@ -2294,7 +2294,7 @@ declare namespace ts {
MarkerType = 8192,
JSLiteral = 16384,
FreshLiteral = 32768,
ClassOrInterface = 3
ClassOrInterface = 3,
}
interface ObjectType extends Type {
objectFlags: ObjectFlags;
@ -2794,7 +2794,7 @@ declare namespace ts {
NoHoisting = 2097152,
HasEndOfDeclarationMarker = 4194304,
Iterator = 8388608,
NoAsciiEscaping = 16777216
NoAsciiEscaping = 16777216,
}
interface EmitHelper {
readonly name: string;

View file

@ -51060,7 +51060,7 @@ var ts;
if (isTupleType(restType)) {
var associatedNames = restType.target.associatedNames;
var index = pos - paramCount;
return associatedNames ? associatedNames[index] : restParameter.escapedName + "_" + index;
return associatedNames && associatedNames[index] || restParameter.escapedName + "_" + index;
}
return restParameter.escapedName;
}
@ -85628,7 +85628,7 @@ var ts;
* Emits any prologue directives at the start of a Statement list, returning the
* number of prologue directives written to the output.
*/
function emitPrologueDirectives(statements, sourceFile, seenPrologueDirectives) {
function emitPrologueDirectives(statements, sourceFile, seenPrologueDirectives, recordBundleFileSection) {
var needsToSetSourceFile = !!sourceFile;
for (var i = 0; i < statements.length; i++) {
var statement = statements[i];
@ -85642,7 +85642,7 @@ var ts;
writeLine();
var pos = writer.getTextPos();
emit(statement);
if (bundleFileInfo)
if (recordBundleFileSection && bundleFileInfo)
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "prologue" /* Prologue */, data: statement.expression.text });
if (seenPrologueDirectives) {
seenPrologueDirectives.set(statement.expression.text, true);
@ -85683,7 +85683,7 @@ var ts;
}
for (var _c = 0, _d = sourceFileOrBundle.sourceFiles; _c < _d.length; _c++) {
var sourceFile = _d[_c];
emitPrologueDirectives(sourceFile.statements, sourceFile, seenPrologueDirectives);
emitPrologueDirectives(sourceFile.statements, sourceFile, seenPrologueDirectives, /*recordBundleFileSection*/ true);
}
setSourceFile(undefined);
}
@ -94647,8 +94647,8 @@ var ts;
if (baseFileName !== "package.json" && baseFileName !== "bower.json") {
continue;
}
var result_7 = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); });
var packageJson = result_7.config;
var result_1 = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); });
var packageJson = result_1.config;
// npm 3's package.json contains a "_requiredBy" field
// we should include all the top level module names for npm 2, and only module names whose
// "_requiredBy" field starts with "#" or equals "/" for npm 3.
@ -95738,8 +95738,8 @@ var ts;
isWhiteSpaceOnlyJsxText(child);
if (lookInPreviousChild) {
// actual start of the node is past the position - previous token should be at the end of previous child
var candidate_2 = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i, sourceFile);
return candidate_2 && findRightmostToken(candidate_2, sourceFile);
var candidate_1 = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i, sourceFile);
return candidate_1 && findRightmostToken(candidate_1, sourceFile);
}
else {
// candidate should be in this node
@ -96652,14 +96652,14 @@ var ts;
ts.visitEachChild(node, getSynthesizedDeepClone, ts.nullTransformationContext);
if (visited === node) {
// This only happens for leaf nodes - internal nodes always see their children change.
var clone_8 = ts.getSynthesizedClone(node);
if (ts.isStringLiteral(clone_8)) {
clone_8.textSourceNode = node;
var clone_1 = ts.getSynthesizedClone(node);
if (ts.isStringLiteral(clone_1)) {
clone_1.textSourceNode = node;
}
else if (ts.isNumericLiteral(clone_8)) {
clone_8.numericLiteralFlags = node.numericLiteralFlags;
else if (ts.isNumericLiteral(clone_1)) {
clone_1.numericLiteralFlags = node.numericLiteralFlags;
}
return ts.setTextRange(clone_8, node);
return ts.setTextRange(clone_1, node);
}
// PERF: As an optimization, rather than calling getSynthesizedClone, we'll update
// the new node created by visitEachChild with the extra changes getSynthesizedClone
@ -97084,7 +97084,7 @@ var ts;
var lastEnd = 0;
for (var i = 0; i < dense.length; i += 3) {
var start = dense[i];
var length_5 = dense[i + 1];
var length_1 = dense[i + 1];
var type = dense[i + 2];
// Make a whitespace entry between the last item and this one.
if (lastEnd >= 0) {
@ -97093,8 +97093,8 @@ var ts;
entries.push({ length: whitespaceLength_1, classification: ts.TokenClass.Whitespace });
}
}
entries.push({ length: length_5, classification: convertClassification(type) });
lastEnd = start + length_5;
entries.push({ length: length_1, classification: convertClassification(type) });
lastEnd = start + length_1;
}
var whitespaceLength = text.length - lastEnd;
if (whitespaceLength > 0) {
@ -98038,8 +98038,8 @@ var ts;
* both foo.ts and foo.tsx become foo
*/
var foundFiles = ts.createMap(); // maps file to its extension
for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {
var filePath = files_3[_i];
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
var filePath = files_1[_i];
filePath = ts.normalizePath(filePath);
if (exclude && ts.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0 /* EqualTo */) {
continue;
@ -98084,7 +98084,7 @@ var ts;
continue;
var patterns = paths[path];
if (patterns) {
var _loop_11 = function (name, kind, extension) {
var _loop_1 = function (name, kind, extension) {
// Path mappings may provide a duplicate way to get to something we've already added, so don't add again.
if (!result.some(function (entry) { return entry.name === name; })) {
result.push(nameAndKind(name, kind, extension));
@ -98092,7 +98092,7 @@ var ts;
};
for (var _i = 0, _a = getCompletionsForPathMapping(path, patterns, fragment, baseDirectory, fileExtensions, host); _i < _a.length; _i++) {
var _b = _a[_i], name = _b.name, kind = _b.kind, extension = _b.extension;
_loop_11(name, kind, extension);
_loop_1(name, kind, extension);
}
}
}
@ -98127,7 +98127,7 @@ var ts;
// (But do if we didn't find anything, e.g. 'package.json' missing.)
var foundGlobal = false;
if (fragmentDirectory === undefined) {
var _loop_12 = function (moduleName) {
var _loop_2 = function (moduleName) {
if (!result.some(function (entry) { return entry.name === moduleName; })) {
foundGlobal = true;
result.push(nameAndKind(moduleName, "external module name" /* externalModuleName */, /*extension*/ undefined));
@ -98135,7 +98135,7 @@ var ts;
};
for (var _b = 0, _c = enumerateNodeModulesVisibleToScript(host, scriptPath); _b < _c.length; _b++) {
var moduleName = _c[_b];
_loop_12(moduleName);
_loop_2(moduleName);
}
}
if (!foundGlobal) {
@ -98249,8 +98249,8 @@ var ts;
// Check for typings specified in compiler options
var seen = ts.createMap();
var typeRoots = tryAndIgnoreErrors(function () { return ts.getEffectiveTypeRoots(options, host); }) || ts.emptyArray;
for (var _i = 0, typeRoots_2 = typeRoots; _i < typeRoots_2.length; _i++) {
var root = typeRoots_2[_i];
for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) {
var root = typeRoots_1[_i];
getCompletionEntriesFromDirectories(root);
}
// Also get all @types typings installed in visible node_modules directories
@ -98612,8 +98612,8 @@ var ts;
// Based on the order we add things we will always see locals first, then globals, then module exports.
// So adding a completion for a local will prevent us from adding completions for external module exports sharing the same name.
var uniques = ts.createMap();
for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
var symbol = symbols_3[_i];
for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
var symbol = symbols_1[_i];
var origin = symbolToOriginInfoMap ? symbolToOriginInfoMap[ts.getSymbolId(symbol)] : undefined;
var entry = createCompletionEntry(symbol, location, sourceFile, typeChecker, target, kind, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences);
if (!entry) {
@ -98913,9 +98913,9 @@ var ts;
// Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS|
// Skip this partial identifier and adjust the contextToken to the token that precedes it.
if (contextToken && position <= contextToken.end && (ts.isIdentifier(contextToken) || ts.isKeyword(contextToken.kind))) {
var start_3 = ts.timestamp();
var start_1 = ts.timestamp();
contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile, /*startNode*/ undefined); // TODO: GH#18217
log("getCompletionData: Get previous token 2: " + (ts.timestamp() - start_3));
log("getCompletionData: Get previous token 2: " + (ts.timestamp() - start_1));
}
// Find the node where completion is requested on.
// Also determine whether we are trying to complete with members of that node
@ -101007,8 +101007,8 @@ var ts;
function findModuleReferences(program, sourceFiles, searchModuleSymbol) {
var refs = [];
var checker = program.getTypeChecker();
for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) {
var referencingFile = sourceFiles_3[_i];
for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) {
var referencingFile = sourceFiles_1[_i];
var searchSourceFile = searchModuleSymbol.valueDeclaration;
if (searchSourceFile.kind === 284 /* SourceFile */) {
for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) {
@ -101038,8 +101038,8 @@ var ts;
/** Returns a map from a module symbol Id to all import statements that directly reference the module. */
function getDirectImportsMap(sourceFiles, checker, cancellationToken) {
var map = ts.createMap();
for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) {
var sourceFile = sourceFiles_4[_i];
for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) {
var sourceFile = sourceFiles_2[_i];
if (cancellationToken)
cancellationToken.throwIfCancellationRequested();
forEachImport(sourceFile, function (importDecl, moduleSpecifier) {
@ -101351,9 +101351,9 @@ var ts;
// If invoked directly on a shorthand property assignment, then return
// the declaration of the symbol being assigned (not the symbol being assigned to).
if (node.parent.kind === 276 /* ShorthandPropertyAssignment */) {
var result_8 = [];
FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_8.push(nodeEntry(node)); });
return result_8;
var result_1 = [];
FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_1.push(nodeEntry(node)); });
return result_1;
}
else if (node.kind === 98 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) {
// References to and accesses on the super keyword only have one possible implementation, so no
@ -101385,27 +101385,27 @@ var ts;
case 0 /* Symbol */: {
var symbol = def.symbol;
var _a = getDefinitionKindAndDisplayParts(symbol, checker, originalNode), displayParts_1 = _a.displayParts, kind_1 = _a.kind;
var name_4 = displayParts_1.map(function (p) { return p.text; }).join("");
return { node: symbol.declarations ? ts.getNameOfDeclaration(ts.first(symbol.declarations)) || ts.first(symbol.declarations) : originalNode, name: name_4, kind: kind_1, displayParts: displayParts_1 };
var name_1 = displayParts_1.map(function (p) { return p.text; }).join("");
return { node: symbol.declarations ? ts.getNameOfDeclaration(ts.first(symbol.declarations)) || ts.first(symbol.declarations) : originalNode, name: name_1, kind: kind_1, displayParts: displayParts_1 };
}
case 1 /* Label */: {
var node_3 = def.node;
return { node: node_3, name: node_3.text, kind: "label" /* label */, displayParts: [ts.displayPart(node_3.text, ts.SymbolDisplayPartKind.text)] };
var node_1 = def.node;
return { node: node_1, name: node_1.text, kind: "label" /* label */, displayParts: [ts.displayPart(node_1.text, ts.SymbolDisplayPartKind.text)] };
}
case 2 /* Keyword */: {
var node_4 = def.node;
var name_5 = ts.tokenToString(node_4.kind);
return { node: node_4, name: name_5, kind: "keyword" /* keyword */, displayParts: [{ text: name_5, kind: "keyword" /* keyword */ }] };
var node_2 = def.node;
var name_2 = ts.tokenToString(node_2.kind);
return { node: node_2, name: name_2, kind: "keyword" /* keyword */, displayParts: [{ text: name_2, kind: "keyword" /* keyword */ }] };
}
case 3 /* This */: {
var node_5 = def.node;
var symbol = checker.getSymbolAtLocation(node_5);
var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_5.getSourceFile(), ts.getContainerNode(node_5), node_5).displayParts || [ts.textPart("this")];
return { node: node_5, name: "this", kind: "var" /* variableElement */, displayParts: displayParts_2 };
var node_3 = def.node;
var symbol = checker.getSymbolAtLocation(node_3);
var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_3.getSourceFile(), ts.getContainerNode(node_3), node_3).displayParts || [ts.textPart("this")];
return { node: node_3, name: "this", kind: "var" /* variableElement */, displayParts: displayParts_2 };
}
case 4 /* String */: {
var node_6 = def.node;
return { node: node_6, name: node_6.text, kind: "var" /* variableElement */, displayParts: [ts.displayPart(ts.getTextOfNode(node_6), ts.SymbolDisplayPartKind.stringLiteral)] };
var node_4 = def.node;
return { node: node_4, name: node_4.text, kind: "var" /* variableElement */, displayParts: [ts.displayPart(ts.getTextOfNode(node_4), ts.SymbolDisplayPartKind.stringLiteral)] };
}
default:
return ts.Debug.assertNever(def);
@ -101683,7 +101683,7 @@ var ts;
result = references;
continue;
}
var _loop_13 = function (entry) {
var _loop_3 = function (entry) {
if (!entry.definition || entry.definition.type !== 0 /* Symbol */) {
result.push(entry);
return "continue";
@ -101715,7 +101715,7 @@ var ts;
};
for (var _b = 0, references_1 = references; _b < references_1.length; _b++) {
var entry = references_1[_b];
_loop_13(entry);
_loop_3(entry);
}
}
return result;
@ -101975,8 +101975,8 @@ var ts;
var sourceId = ts.getNodeId(sourceFile);
var seenSymbols = this.sourceFileToSeenSymbols[sourceId] || (this.sourceFileToSeenSymbols[sourceId] = ts.createMap());
var anyNewSymbols = false;
for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) {
var sym = symbols_4[_i];
for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
var sym = symbols_2[_i];
anyNewSymbols = ts.addToSeen(seenSymbols, ts.getSymbolId(sym)) || anyNewSymbols;
}
return anyNewSymbols;
@ -102115,8 +102115,8 @@ var ts;
return undefined;
}
var scope;
for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) {
var declaration = declarations_11[_i];
for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) {
var declaration = declarations_1[_i];
var container = ts.getContainerNode(declaration);
if (scope && scope !== container) {
// Different declarations have different containers, bail out
@ -102167,8 +102167,8 @@ var ts;
if (!signature.name || !ts.isIdentifier(signature.name))
return;
var symbol = ts.Debug.assertDefined(checker.getSymbolAtLocation(signature.name));
for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) {
var sourceFile = sourceFiles_5[_i];
for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) {
var sourceFile = sourceFiles_3[_i];
for (var _a = 0, _b = getPossibleSymbolReferenceNodes(sourceFile, symbol.name); _a < _b.length; _a++) {
var name = _b[_a];
if (!ts.isIdentifier(name) || name === signature.name || name.escapedText !== signature.name.escapedText)
@ -102870,8 +102870,8 @@ var ts;
// To achieve that we will keep iterating until the result stabilizes.
// Remember the last meaning
lastIterationMeaning = meaning;
for (var _i = 0, declarations_12 = declarations; _i < declarations_12.length; _i++) {
var declaration = declarations_12[_i];
for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) {
var declaration = declarations_2[_i];
var declarationMeaning = ts.getMeaningFromDeclaration(declaration);
if (declarationMeaning & meaning) {
meaning |= declarationMeaning;
@ -103020,8 +103020,8 @@ var ts;
// Type annotation needed due to #7294
var elements = ts.isArrayLiteralExpression(property.initializer) ? property.initializer.elements : [property.initializer];
var foundExactMatch = false;
for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) {
var element = elements_5[_i];
for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {
var element = elements_1[_i];
foundExactMatch = tryUpdateString(element) || foundExactMatch;
}
return foundExactMatch;
@ -103043,7 +103043,7 @@ var ts;
}
function updateImports(program, changeTracker, oldToNew, newToOld, host, getCanonicalFileName) {
var allFiles = program.getSourceFiles();
var _loop_14 = function (sourceFile) {
var _loop_4 = function (sourceFile) {
var newFromOld = oldToNew(sourceFile.path);
var newImportFromPath = newFromOld !== undefined ? newFromOld : sourceFile.path;
var newImportFromDirectory = ts.getDirectoryPath(newImportFromPath);
@ -103075,7 +103075,7 @@ var ts;
};
for (var _i = 0, allFiles_1 = allFiles; _i < allFiles_1.length; _i++) {
var sourceFile = allFiles_1[_i];
_loop_14(sourceFile);
_loop_4(sourceFile);
}
}
function combineNormal(pathA, pathB) {
@ -103105,9 +103105,9 @@ var ts;
return undefined;
// First try resolved module
if (resolved.resolvedModule) {
var result_9 = tryChange(resolved.resolvedModule.resolvedFileName);
if (result_9)
return result_9;
var result_2 = tryChange(resolved.resolvedModule.resolvedFileName);
if (result_2)
return result_2;
}
// Then failed lookups except package.json since we dont want to touch them (only included ts/js files)
var result = ts.forEach(resolved.failedLookupLocations, tryChangeWithIgnoringPackageJson);
@ -103217,10 +103217,10 @@ var ts;
// bar<Test>(({pr/*goto*/op1})=>{});
if (ts.isPropertyName(node) && ts.isBindingElement(parent) && ts.isObjectBindingPattern(parent.parent) &&
(node === (parent.propertyName || parent.name))) {
var name_6 = ts.getNameFromPropertyName(node);
var name_3 = ts.getNameFromPropertyName(node);
var type = typeChecker.getTypeAtLocation(parent.parent);
return name_6 === undefined ? ts.emptyArray : ts.flatMap(type.isUnion() ? type.types : [type], function (t) {
var prop = t.getProperty(name_6);
return name_3 === undefined ? ts.emptyArray : ts.flatMap(type.isUnion() ? type.types : [type], function (t) {
var prop = t.getProperty(name_3);
return prop && getDefinitionFromSymbol(typeChecker, prop, node);
});
}
@ -103865,7 +103865,7 @@ var ts;
if (!patternMatcher)
return ts.emptyArray;
var rawItems = [];
var _loop_15 = function (sourceFile) {
var _loop_5 = function (sourceFile) {
cancellationToken.throwIfCancellationRequested();
if (excludeDtsFiles && sourceFile.isDeclarationFile) {
return "continue";
@ -103875,9 +103875,9 @@ var ts;
});
};
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) {
var sourceFile = sourceFiles_6[_i];
_loop_15(sourceFile);
for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) {
var sourceFile = sourceFiles_4[_i];
_loop_5(sourceFile);
}
rawItems.sort(compareNavigateToItems);
return (maxResultCount === undefined ? rawItems : rawItems.slice(0, maxResultCount)).map(createNavigateToItem);
@ -103890,8 +103890,8 @@ var ts;
if (!match) {
return; // continue to next named declarations
}
for (var _i = 0, declarations_13 = declarations; _i < declarations_13.length; _i++) {
var declaration = declarations_13[_i];
for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {
var declaration = declarations_3[_i];
if (!shouldKeepItem(declaration, checker))
continue;
if (patternMatcher.patternContainsDots) {
@ -104994,8 +104994,8 @@ var ts;
var lastSingleLineCommentEnd = -1;
var singleLineCommentCount = 0;
var sourceText = sourceFile.getFullText();
for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) {
var _a = comments_2[_i], kind = _a.kind, pos = _a.pos, end = _a.end;
for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) {
var _a = comments_1[_i], kind = _a.kind, pos = _a.pos, end = _a.end;
cancellationToken.throwIfCancellationRequested();
switch (kind) {
case 2 /* SingleLineCommentTrivia */:
@ -105405,15 +105405,15 @@ var ts;
// Assumes 'value' is already lowercase.
function indexOfIgnoringCase(str, value) {
var n = str.length - value.length;
var _loop_16 = function (start) {
var _loop_6 = function (start) {
if (every(value, function (valueChar, i) { return toLowerCase(str.charCodeAt(i + start)) === valueChar; })) {
return { value: start };
}
};
for (var start = 0; start <= n; start++) {
var state_4 = _loop_16(start);
if (typeof state_4 === "object")
return state_4.value;
var state_1 = _loop_6(start);
if (typeof state_1 === "object")
return state_1.value;
}
return -1;
}
@ -106424,7 +106424,7 @@ var ts;
return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
}
function getContainingArgumentInfo(node, position, sourceFile, checker, isManuallyInvoked) {
var _loop_17 = function (n) {
var _loop_7 = function (n) {
// If the node is not a subspan of its parent, this is a big problem.
// There have been crashes that might be caused by this violation.
ts.Debug.assert(ts.rangeContainsRange(n.parent, n), "Not a subspan", function () { return "Child: " + ts.Debug.showSyntaxKind(n) + ", parent: " + ts.Debug.showSyntaxKind(n.parent); });
@ -106434,9 +106434,9 @@ var ts;
}
};
for (var n = node; !ts.isSourceFile(n) && (isManuallyInvoked || !ts.isBlock(n)); n = n.parent) {
var state_5 = _loop_17(n);
if (typeof state_5 === "object")
return state_5.value;
var state_2 = _loop_7(n);
if (typeof state_2 === "object")
return state_2.value;
}
return undefined;
}
@ -106714,8 +106714,8 @@ var ts;
var name = importNameForConvertToDefaultImport(importNode);
if (!name)
continue;
var module_2 = ts.getResolvedModule(sourceFile, moduleSpecifier.text);
var resolvedFile = module_2 && program.getSourceFile(module_2.resolvedFileName);
var module = ts.getResolvedModule(sourceFile, moduleSpecifier.text);
var resolvedFile = module && program.getSourceFile(module.resolvedFileName);
if (resolvedFile && resolvedFile.externalModuleIndicator && ts.isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) {
diags.push(ts.createDiagnosticForNode(name, ts.Diagnostics.Import_may_be_converted_to_a_default_import));
}
@ -106730,8 +106730,8 @@ var ts;
case 196 /* FunctionExpression */:
var decl = ts.getDeclarationOfExpando(node);
if (decl) {
var symbol_2 = decl.symbol;
if (symbol_2 && (symbol_2.exports && symbol_2.exports.size || symbol_2.members && symbol_2.members.size)) {
var symbol_1 = decl.symbol;
if (symbol_1 && (symbol_1.exports && symbol_1.exports.size || symbol_1.members && symbol_1.members.size)) {
diags.push(ts.createDiagnosticForNode(ts.isVariableDeclaration(node.parent) ? node.parent.name : node, ts.Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration));
break;
}
@ -107591,7 +107591,7 @@ var ts;
return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; });
});
options = ts.cloneCompilerOptions(options);
var _loop_18 = function (opt) {
var _loop_8 = function (opt) {
if (!ts.hasProperty(options, opt.name)) {
return "continue";
}
@ -107610,7 +107610,7 @@ var ts;
};
for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {
var opt = commandLineOptionsStringToEnum_1[_i];
_loop_18(opt);
_loop_8(opt);
}
return options;
}
@ -110782,7 +110782,7 @@ var ts;
ChangeTracker.prototype.finishDeleteDeclarations = function () {
var _this = this;
var deletedNodesInLists = new ts.NodeSet(); // Stores nodes in lists that we already deleted. Used to avoid deleting `, ` twice in `a, b`.
var _loop_19 = function (sourceFile, node) {
var _loop_9 = function (sourceFile, node) {
if (!this_1.deletedNodes.some(function (d) { return d.sourceFile === sourceFile && ts.rangeContainsRangeExclusive(d.node, node); })) {
if (ts.isArray(node)) {
this_1.deleteRange(sourceFile, ts.rangeOfTypeParameters(node));
@ -110795,7 +110795,7 @@ var ts;
var this_1 = this;
for (var _i = 0, _a = this.deletedNodes; _i < _a.length; _i++) {
var _b = _a[_i], sourceFile = _b.sourceFile, node = _b.node;
_loop_19(sourceFile, node);
_loop_9(sourceFile, node);
}
deletedNodesInLists.forEach(function (node) {
var sourceFile = node.getSourceFile();
@ -110852,14 +110852,14 @@ var ts;
// order changes by start position
// If the start position is the same, put the shorter range first, since an empty range (x, x) may precede (x, y) but not vice-versa.
var normalized = ts.stableSort(changesInFile, function (a, b) { return (a.range.pos - b.range.pos) || (a.range.end - b.range.end); });
var _loop_20 = function (i) {
var _loop_10 = function (i) {
ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", function () {
return JSON.stringify(normalized[i].range) + " and " + JSON.stringify(normalized[i + 1].range);
});
};
// verify that change intervals do not overlap, except possibly at end points.
for (var i = 0; i < normalized.length - 1; i++) {
_loop_20(i);
_loop_10(i);
}
var textChanges = normalized.map(function (c) {
return ts.createTextChange(ts.createTextSpanFromRange(c.range), computeNewText(c, sourceFile, newLineCharacter, formatContext, validate));
@ -112258,8 +112258,8 @@ var ts;
}
function removeLowPriorityInferences(inferences, priorities) {
var toRemove = [];
for (var _i = 0, inferences_2 = inferences; _i < inferences_2.length; _i++) {
var i = inferences_2[_i];
for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) {
var i = inferences_1[_i];
for (var _a = 0, priorities_1 = priorities; _a < priorities_1.length; _a++) {
var _b = priorities_1[_a], high = _b.high, low = _b.low;
if (high(i)) {
@ -112351,8 +112351,8 @@ var ts;
types.push.apply(types, (usageContext.candidateTypes || []).map(function (t) { return checker.getBaseTypeOfLiteralType(t); }));
if (usageContext.properties && hasCallContext(usageContext.properties.get("then"))) {
var paramType = getParameterTypeFromCallContexts(0, usageContext.properties.get("then").callContexts, /*isRestParameter*/ false, checker); // TODO: GH#18217
var types_20 = paramType.getCallSignatures().map(function (c) { return c.getReturnType(); });
types_20.push(checker.createPromiseType(types_20.length ? checker.getUnionType(types_20, 2 /* Subtype */) : checker.getAnyType()));
var types_1 = paramType.getCallSignatures().map(function (c) { return c.getReturnType(); });
types_1.push(checker.createPromiseType(types_1.length ? checker.getUnionType(types_1, 2 /* Subtype */) : checker.getAnyType()));
}
else if (usageContext.properties && hasCallContext(usageContext.properties.get("push"))) {
types.push(checker.createArrayType(getParameterTypeFromCallContexts(0, usageContext.properties.get("push").callContexts, /*isRestParameter*/ false, checker)));
@ -112361,7 +112361,7 @@ var ts;
types.push(checker.createArrayType(recur(usageContext.numberIndexContext)));
}
else if (usageContext.properties || usageContext.callContexts || usageContext.constructContexts || usageContext.stringIndexContext) {
var members_6 = ts.createUnderscoreEscapedMap();
var members_1 = ts.createUnderscoreEscapedMap();
var callSignatures = [];
var constructSignatures = [];
var stringIndexInfo = void 0;
@ -112369,7 +112369,7 @@ var ts;
usageContext.properties.forEach(function (context, name) {
var symbol = checker.createSymbol(4 /* Property */, name);
symbol.type = recur(context);
members_6.set(name, symbol);
members_1.set(name, symbol);
});
}
if (usageContext.callContexts) {
@ -112387,7 +112387,7 @@ var ts;
if (usageContext.stringIndexContext) {
stringIndexInfo = checker.createIndexInfo(recur(usageContext.stringIndexContext), /*isReadonly*/ false);
}
types.push(checker.createAnonymousType(/*symbol*/ undefined, members_6, callSignatures, constructSignatures, stringIndexInfo, /*numberIndexInfo*/ undefined)); // TODO: GH#18217
types.push(checker.createAnonymousType(/*symbol*/ undefined, members_1, callSignatures, constructSignatures, stringIndexInfo, /*numberIndexInfo*/ undefined)); // TODO: GH#18217
}
return types;
function recur(innerContext) {
@ -112656,7 +112656,7 @@ var ts;
var newNodes = transformExpression(node, transformer, node);
changes.replaceNodeWithNodes(sourceFile, nodeToReplace, newNodes);
}
var _loop_21 = function (statement) {
var _loop_11 = function (statement) {
ts.forEachChild(statement, function visit(node) {
if (ts.isCallExpression(node)) {
startTransformation(node, statement);
@ -112668,7 +112668,7 @@ var ts;
};
for (var _i = 0, returnStatements_1 = returnStatements; _i < returnStatements_1.length; _i++) {
var statement = returnStatements_1[_i];
_loop_21(statement);
_loop_11(statement);
}
}
function getReturnStatementsWithPromiseHandlers(body) {
@ -112993,8 +112993,8 @@ var ts;
if (innerCbBody.length > 0) {
return innerCbBody;
}
var type_6 = transformer.checker.getTypeAtLocation(func);
var returnType_1 = getLastCallSignature(type_6, transformer.checker).getReturnType();
var type_1 = transformer.checker.getTypeAtLocation(func);
var returnType_1 = getLastCallSignature(type_1, transformer.checker).getReturnType();
var rightHandSide = ts.getSynthesizedDeepClone(funcBody);
var possiblyAwaitedRightHandSide = !!transformer.checker.getPromisedTypeOfPromise(returnType_1) ? ts.createAwait(rightHandSide) : rightHandSide;
if (!shouldReturn) {
@ -114320,7 +114320,7 @@ var ts;
});
typeDeclToMembers.forEach(function (infos, classDeclaration) {
var supers = getAllSupers(classDeclaration, checker);
var _loop_22 = function (info) {
var _loop_12 = function (info) {
// If some superclass added this property, don't add it again.
if (supers.some(function (superClassOrInterface) {
var superInfos = typeDeclToMembers.get(superClassOrInterface);
@ -114347,7 +114347,7 @@ var ts;
};
for (var _i = 0, infos_1 = infos; _i < infos_1.length; _i++) {
var info = infos_1[_i];
_loop_22(info);
_loop_12(info);
}
});
}));
@ -115582,8 +115582,8 @@ var ts;
outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences));
break;
}
for (var _i = 0, signatures_7 = signatures; _i < signatures_7.length; _i++) {
var signature = signatures_7[_i];
for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) {
var signature = signatures_1[_i];
// Need to ensure nodes are fresh each time so they can have different positions.
outputMethod(signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false));
}
@ -115666,8 +115666,8 @@ var ts;
var maxArgsSignature = signatures[0];
var minArgumentCount = signatures[0].minArgumentCount;
var someSigHasRestParameter = false;
for (var _i = 0, signatures_8 = signatures; _i < signatures_8.length; _i++) {
var sig = signatures_8[_i];
for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) {
var sig = signatures_2[_i];
minArgumentCount = Math.min(sig.minArgumentCount, minArgumentCount);
if (sig.hasRestParameter) {
someSigHasRestParameter = true;
@ -115826,8 +115826,8 @@ var ts;
ts.addRange(fixes, getCodeFixesForImportDeclaration(context, relatedImport));
}
if (ts.isExpression(expr) && !(ts.isNamedDeclaration(expr.parent) && expr.parent.name === expr)) {
var sourceFile_3 = context.sourceFile;
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile_3, expr, ts.createPropertyAccess(expr, "default"), {}); });
var sourceFile_1 = context.sourceFile;
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile_1, expr, ts.createPropertyAccess(expr, "default"), {}); });
fixes.push(codefix.createCodeFixActionNoFixId(fixName, changes, ts.Diagnostics.Use_synthetic_default_member));
}
return fixes;
@ -116107,9 +116107,9 @@ var ts;
forEachOwnNodeOfFunction(fnAst, function (node) {
if (ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) &&
ts.isPropertyAccessExpression(node.left) && node.left.expression.kind === 100 /* ThisKeyword */) {
var name_7 = node.left.name.text;
if (!ts.isJsPrivate(name_7)) {
ts.getOrUpdate(members, name_7, function () { return ts.createProperty(/*decorators*/ undefined, /*modifiers*/ undefined, name_7, /*questionOrExclamationToken*/ undefined, anyType(), /*initializer*/ undefined); });
var name_4 = node.left.name.text;
if (!ts.isJsPrivate(name_4)) {
ts.getOrUpdate(members, name_4, function () { return ts.createProperty(/*decorators*/ undefined, /*modifiers*/ undefined, name_4, /*questionOrExclamationToken*/ undefined, anyType(), /*initializer*/ undefined); });
}
}
});
@ -116624,7 +116624,7 @@ var ts;
});
var namespaceImportName = namespaceNameConflicts ? ts.getUniqueName(preferredName, sourceFile) : preferredName;
var neededNamedImports = [];
var _loop_23 = function (element) {
var _loop_13 = function (element) {
var propertyName = (element.propertyName || element.name).text;
ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
var access = ts.createPropertyAccess(ts.createIdentifier(namespaceImportName), propertyName);
@ -116643,7 +116643,7 @@ var ts;
};
for (var _i = 0, _a = toConvert.elements; _i < _a.length; _i++) {
var element = _a[_i];
_loop_23(element);
_loop_13(element);
}
changes.replaceNode(sourceFile, toConvert, ts.createNamespaceImport(ts.createIdentifier(namespaceImportName)));
if (neededNamedImports.length) {
@ -117698,8 +117698,8 @@ var ts;
ts.Debug.assert(members.length > 0); // There must be at least one child, since we extracted from one.
var prevMember;
var allProperties = true;
for (var _i = 0, members_7 = members; _i < members_7.length; _i++) {
var member = members_7[_i];
for (var _i = 0, members_2 = members; _i < members_2.length; _i++) {
var member = members_2[_i];
if (member.pos > maxPos) {
return prevMember || members[0];
}
@ -117873,7 +117873,7 @@ var ts;
: ts.getEnclosingBlockScopeContainer(scopes[0]);
ts.forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations);
}
var _loop_24 = function (i) {
var _loop_14 = function (i) {
var scopeUsages = usagesPerScope[i];
// Special case: in the innermost scope, all usages are available.
// (The computed value reflects the value at the top-level of the scope, but the
@ -117913,7 +117913,7 @@ var ts;
}
};
for (var i = 0; i < scopes.length; i++) {
_loop_24(i);
_loop_14(i);
}
return { target: target, usagesPerScope: usagesPerScope, functionErrorsPerScope: functionErrorsPerScope, constantErrorsPerScope: constantErrorsPerScope, exposedVariableDeclarations: exposedVariableDeclarations };
function isInGenericContext(node) {
@ -118464,10 +118464,10 @@ var ts;
}
function updateImportsInOtherFiles(changes, program, oldFile, movedSymbols, newModuleName) {
var checker = program.getTypeChecker();
var _loop_25 = function (sourceFile) {
var _loop_15 = function (sourceFile) {
if (sourceFile === oldFile)
return "continue";
var _loop_26 = function (statement) {
var _loop_16 = function (statement) {
forEachImportInStatement(statement, function (importNode) {
if (checker.getSymbolAtLocation(moduleSpecifierFromImport(importNode)) !== oldFile.symbol)
return;
@ -118489,12 +118489,12 @@ var ts;
};
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var statement = _a[_i];
_loop_26(statement);
_loop_16(statement);
}
};
for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
var sourceFile = _a[_i];
_loop_25(sourceFile);
_loop_15(sourceFile);
}
}
function getNamespaceLikeImport(node) {
@ -118609,9 +118609,9 @@ var ts;
if (isTopLevelDeclarationStatement(statement) &&
!isExported(sourceFile, statement, useEs6Exports) &&
forEachTopLevelDeclaration(statement, function (d) { return needExport.has(ts.Debug.assertDefined(d.symbol)); })) {
var exports_2 = addExport(statement, useEs6Exports);
if (exports_2)
return exports_2;
var exports = addExport(statement, useEs6Exports);
if (exports)
return exports;
}
return statement;
});
@ -119284,8 +119284,8 @@ var ts;
var list = createNode(311 /* SyntaxList */, nodes.pos, nodes.end, parent);
list._children = [];
var pos = nodes.pos;
for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) {
var node = nodes_7[_i];
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
var node = nodes_1[_i];
addSyntheticNodes(list._children, pos, node.pos, parent);
list._children.push(node);
pos = node.end;
@ -119529,8 +119529,8 @@ var ts;
return ts.emptyArray;
var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations);
if (doc.length === 0 || declarations.some(hasJSDocInheritDocTag)) {
for (var _i = 0, declarations_14 = declarations; _i < declarations_14.length; _i++) {
var declaration = declarations_14[_i];
for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
var declaration = declarations_4[_i];
var inheritedDocs = findInheritedJSDocComments(declaration, declaration.symbol.name, checker); // TODO: GH#18217
// TODO: GH#16312 Return a ReadonlyArray, avoid copying inheritedDocs
if (inheritedDocs)
@ -120282,14 +120282,14 @@ var ts;
var typeChecker = program.getTypeChecker();
var symbol = getSymbolAtLocationForQuickInfo(node, typeChecker);
if (!symbol || typeChecker.isUnknownSymbol(symbol)) {
var type_7 = shouldGetType(sourceFile, node, position) ? typeChecker.getTypeAtLocation(node) : undefined;
return type_7 && {
var type_2 = shouldGetType(sourceFile, node, position) ? typeChecker.getTypeAtLocation(node) : undefined;
return type_2 && {
kind: "" /* unknown */,
kindModifiers: "" /* none */,
textSpan: ts.createTextSpanFromNode(node, sourceFile),
displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_7, ts.getContainerNode(node)); }),
documentation: type_7.symbol ? type_7.symbol.getDocumentationComment(typeChecker) : undefined,
tags: type_7.symbol ? type_7.symbol.getJsDocTags() : undefined
displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_2, ts.getContainerNode(node)); }),
documentation: type_2.symbol ? type_2.symbol.getDocumentationComment(typeChecker) : undefined,
tags: type_2.symbol ? type_2.symbol.getJsDocTags() : undefined
};
}
var _a = typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) {
@ -123415,8 +123415,8 @@ var ts;
dts: 0, dtsSize: 0,
deferred: 0, deferredSize: 0,
};
for (var _i = 0, infos_2 = infos; _i < infos_2.length; _i++) {
var info = infos_2[_i];
for (var _i = 0, infos_1 = infos; _i < infos_1.length; _i++) {
var info = infos_1[_i];
var fileSize = includeSizes ? info.getTelemetryFileSize() : 0;
switch (info.scriptKind) {
case 1 /* JS */:
@ -124208,8 +124208,8 @@ var ts;
var sourceFiles = this.program.getSourceFiles();
var strBuilder = "\tFiles (" + sourceFiles.length + ")\n";
if (writeProjectFileNames) {
for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) {
var file = sourceFiles_7[_i];
for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) {
var file = sourceFiles_1[_i];
strBuilder += "\t" + file.fileName + "\n";
}
}
@ -124304,7 +124304,7 @@ var ts;
// ../../.. to walk from X/node_modules/typescript/lib/tsserver.js to X/node_modules/
var searchPaths = [ts.combinePaths(this.projectService.getExecutingFilePath(), "../../..")].concat(this.projectService.pluginProbeLocations);
if (this.projectService.globalPlugins) {
var _loop_27 = function (globalPluginName) {
var _loop_1 = function (globalPluginName) {
// Skip empty names from odd commandline parses
if (!globalPluginName)
return "continue";
@ -124312,14 +124312,14 @@ var ts;
if (options.plugins && options.plugins.some(function (p) { return p.name === globalPluginName; }))
return "continue";
// Provide global: true so plugins can detect why they can't find their config
this_2.projectService.logger.info("Loading global plugin " + globalPluginName);
this_2.enablePlugin({ name: globalPluginName, global: true }, searchPaths, pluginConfigOverrides);
this_1.projectService.logger.info("Loading global plugin " + globalPluginName);
this_1.enablePlugin({ name: globalPluginName, global: true }, searchPaths, pluginConfigOverrides);
};
var this_2 = this;
var this_1 = this;
// Enable global plugins with synthetic configuration entries
for (var _i = 0, _a = this.projectService.globalPlugins; _i < _a.length; _i++) {
var globalPluginName = _a[_i];
_loop_27(globalPluginName);
_loop_1(globalPluginName);
}
}
};
@ -125491,7 +125491,7 @@ var ts;
}
project.updateGraph();
if (!this.useSingleInferredProject && !project.projectRootPath) {
var _loop_28 = function (inferredProject) {
var _loop_2 = function (inferredProject) {
if (inferredProject === project || inferredProject.isOrphan()) {
return "continue";
}
@ -125512,7 +125512,7 @@ var ts;
// Note that we need to create a copy of the array since the list of project can change
for (var _i = 0, _a = this.inferredProjects; _i < _a.length; _i++) {
var inferredProject = _a[_i];
_loop_28(inferredProject);
_loop_2(inferredProject);
}
}
return project;
@ -125886,8 +125886,8 @@ var ts;
this.projectToSizeMap.set(name, 0);
this.projectToSizeMap.forEach(function (val) { return (availableSpace -= (val || 0)); });
var totalNonTsFileSize = 0;
for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) {
var f = fileNames_2[_i];
for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) {
var f = fileNames_1[_i];
var fileName = propertyReader.getFileName(f);
if (ts.hasTSFileExtension(fileName)) {
continue;
@ -126052,8 +126052,8 @@ var ts;
ProjectService.prototype.updateNonInferredProjectFiles = function (project, files, propertyReader) {
var projectRootFilesMap = project.getRootFilesMap();
var newRootScriptInfoMap = ts.createMap();
for (var _i = 0, files_4 = files; _i < files_4.length; _i++) {
var f = files_4[_i];
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
var f = files_1[_i];
var newRootFile = propertyReader.getFileName(f);
var normalizedPath = server.toNormalizedPath(newRootFile);
var isDynamic = server.isDynamicFileName(normalizedPath);
@ -126271,7 +126271,7 @@ var ts;
return projects;
function combineProjects(toAddInfo) {
if (toAddInfo !== info) {
var _loop_29 = function (project) {
var _loop_3 = function (project) {
// Add the projects only if they can use symLink targets and not already in the list
if (project.languageServiceEnabled &&
!project.isOrphan() &&
@ -126288,7 +126288,7 @@ var ts;
};
for (var _i = 0, _a = toAddInfo.containingProjects; _i < _a.length; _i++) {
var project = _a[_i];
_loop_29(project);
_loop_3(project);
}
}
}
@ -126958,13 +126958,13 @@ var ts;
this.printProjects();
};
ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, result) {
var _loop_30 = function (proj) {
var _loop_4 = function (proj) {
var knownProject = ts.find(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName(); });
result.push(proj.getChangesSinceVersion(knownProject && knownProject.version));
};
for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) {
var proj = currentProjects_1[_i];
_loop_30(proj);
_loop_4(proj);
}
};
/* @internal */
@ -127074,12 +127074,12 @@ var ts;
var excludeRules = [];
var normalizedNames = rootFiles.map(function (f) { return ts.normalizeSlashes(f.fileName); });
var excludedFiles = [];
var _loop_31 = function (name) {
var rule = this_3.safelist[name];
var _loop_5 = function (name) {
var rule = this_2.safelist[name];
for (var _i = 0, normalizedNames_1 = normalizedNames; _i < normalizedNames_1.length; _i++) {
var root = normalizedNames_1[_i];
if (rule.match.test(root)) {
this_3.logger.info("Excluding files based on rule " + name + " matching file '" + root + "'");
this_2.logger.info("Excluding files based on rule " + name + " matching file '" + root + "'");
// If the file matches, collect its types packages and exclude rules
if (rule.types) {
for (var _a = 0, _b = rule.types; _a < _b.length; _a++) {
@ -127092,7 +127092,7 @@ var ts;
}
}
if (rule.exclude) {
var _loop_33 = function (exclude) {
var _loop_7 = function (exclude) {
var processedRule = root.replace(rule.match, function () {
var groups = [];
for (var _i = 0; _i < arguments.length; _i++) {
@ -127119,7 +127119,7 @@ var ts;
};
for (var _c = 0, _d = rule.exclude; _c < _d.length; _c++) {
var exclude = _d[_c];
_loop_33(exclude);
_loop_7(exclude);
}
}
else {
@ -127132,14 +127132,14 @@ var ts;
}
}
};
var this_3 = this;
var this_2 = this;
for (var _i = 0, _a = Object.keys(this.safelist); _i < _a.length; _i++) {
var name = _a[_i];
_loop_31(name);
_loop_5(name);
}
var excludeRegexes = excludeRules.map(function (e) { return new RegExp(e, "i"); });
var filesToKeep = [];
var _loop_32 = function (i) {
var _loop_6 = function (i) {
if (excludeRegexes.some(function (re) { return re.test(normalizedNames[i]); })) {
excludedFiles.push(normalizedNames[i]);
}
@ -127150,9 +127150,9 @@ var ts;
if (ts.fileExtensionIs(baseName, "js")) {
var inferredTypingName = ts.removeFileExtension(baseName);
var cleanedTypingName = ts.removeMinAndVersionNumbers(inferredTypingName);
var typeName = this_4.legacySafelist.get(cleanedTypingName);
var typeName = this_3.legacySafelist.get(cleanedTypingName);
if (typeName !== undefined) {
this_4.logger.info("Excluded '" + normalizedNames[i] + "' because it matched " + cleanedTypingName + " from the legacy safelist");
this_3.logger.info("Excluded '" + normalizedNames[i] + "' because it matched " + cleanedTypingName + " from the legacy safelist");
excludedFiles.push(normalizedNames[i]);
// *exclude* it from the project...
exclude = true;
@ -127175,9 +127175,9 @@ var ts;
}
}
};
var this_4 = this;
var this_3 = this;
for (var i = 0; i < proj.rootFiles.length; i++) {
_loop_32(i);
_loop_6(i);
}
proj.rootFiles = filesToKeep;
return excludedFiles;
@ -127582,7 +127582,7 @@ var ts;
var outputs = [];
combineProjectOutputWorker(projects, defaultProject, initialLocation, function (_a, getMappedLocation) {
var project = _a.project, location = _a.location;
var _loop_34 = function (outputReferencedSymbol) {
var _loop_8 = function (outputReferencedSymbol) {
var mappedDefinitionFile = getMappedLocation(project, documentSpanLocation(outputReferencedSymbol.definition));
var definition = mappedDefinitionFile === undefined ? outputReferencedSymbol.definition : __assign({}, outputReferencedSymbol.definition, { textSpan: ts.createTextSpan(mappedDefinitionFile.pos, outputReferencedSymbol.definition.textSpan.length), fileName: mappedDefinitionFile.fileName });
var symbolToAddTo = ts.find(outputs, function (o) { return ts.documentSpansEqual(o.definition, definition); });
@ -127600,7 +127600,7 @@ var ts;
};
for (var _i = 0, _b = project.getLanguageService().findReferences(location.fileName, location.pos) || server.emptyArray; _i < _b.length; _i++) {
var outputReferencedSymbol = _b[_i];
_loop_34(outputReferencedSymbol);
_loop_8(outputReferencedSymbol);
}
}, function () { return getDefinitionLocation(defaultProject, initialLocation); });
return outputs.filter(function (o) { return o.references.length !== 0; });
@ -128627,11 +128627,11 @@ var ts;
for (var _i = 0, locations_1 = locations; _i < locations_1.length; _i++) {
var _a = locations_1[_i];
var fileName = _a.fileName, textSpan = _a.textSpan, _ = _a.originalTextSpan, _1 = _a.originalFileName, prefixSuffixText = __rest(_a, ["fileName", "textSpan", "originalTextSpan", "originalFileName"]);
var group_2 = map.get(fileName);
if (!group_2)
map.set(fileName, group_2 = { file: fileName, locs: [] });
var group_1 = map.get(fileName);
if (!group_1)
map.set(fileName, group_1 = { file: fileName, locs: [] });
var scriptInfo = ts.Debug.assertDefined(this.projectService.getScriptInfo(fileName));
group_2.locs.push(__assign({}, this.toLocationTextSpan(textSpan, scriptInfo), prefixSuffixText));
group_1.locs.push(__assign({}, this.toLocationTextSpan(textSpan, scriptInfo), prefixSuffixText));
}
return ts.arrayFrom(map.values());
};
@ -128648,7 +128648,7 @@ var ts;
var symbolDisplayString = nameInfo ? ts.displayPartsToString(nameInfo.displayParts) : "";
var nameSpan = nameInfo && nameInfo.textSpan;
var symbolStartOffset = nameSpan ? scriptInfo.positionToLineOffset(nameSpan.start).offset : 0;
var symbolName_3 = nameSpan ? scriptInfo.getSnapshot().getText(nameSpan.start, ts.textSpanEnd(nameSpan)) : "";
var symbolName_1 = nameSpan ? scriptInfo.getSnapshot().getText(nameSpan.start, ts.textSpanEnd(nameSpan)) : "";
var refs = ts.flatMap(references, function (referencedSymbol) {
return referencedSymbol.references.map(function (_a) {
var fileName = _a.fileName, textSpan = _a.textSpan, isWriteAccess = _a.isWriteAccess, isDefinition = _a.isDefinition;
@ -128659,7 +128659,7 @@ var ts;
return __assign({}, toFileSpan(fileName, textSpan, scriptInfo), { lineText: lineText, isWriteAccess: isWriteAccess, isDefinition: isDefinition });
});
});
var result = { refs: refs, symbolName: symbolName_3, symbolStartOffset: symbolStartOffset, symbolDisplayString: symbolDisplayString };
var result = { refs: refs, symbolName: symbolName_1, symbolStartOffset: symbolStartOffset, symbolDisplayString: symbolDisplayString };
return result;
}
else {
@ -128871,10 +128871,10 @@ var ts;
var prefix = args.prefix || "";
var entries = ts.mapDefined(completions.entries, function (entry) {
if (completions.isMemberCompletion || ts.startsWith(entry.name.toLowerCase(), prefix.toLowerCase())) {
var name = entry.name, kind_2 = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, insertText = entry.insertText, replacementSpan = entry.replacementSpan, hasAction = entry.hasAction, source = entry.source, isRecommended = entry.isRecommended;
var name = entry.name, kind_1 = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, insertText = entry.insertText, replacementSpan = entry.replacementSpan, hasAction = entry.hasAction, source = entry.source, isRecommended = entry.isRecommended;
var convertedSpan = replacementSpan ? _this.toLocationTextSpan(replacementSpan, scriptInfo) : undefined;
// Use `hasAction || undefined` to avoid serializing `false`.
return { name: name, kind: kind_2, kindModifiers: kindModifiers, sortText: sortText, insertText: insertText, replacementSpan: convertedSpan, hasAction: hasAction || undefined, source: source, isRecommended: isRecommended };
return { name: name, kind: kind_1, kindModifiers: kindModifiers, sortText: sortText, insertText: insertText, replacementSpan: convertedSpan, hasAction: hasAction || undefined, source: source, isRecommended: isRecommended };
}
}).sort(function (a, b) { return ts.compareStringsCaseSensitiveUI(a.name, b.name); });
if (kind === "completions" /* Completions */) {
@ -129453,14 +129453,14 @@ var ts;
}
server.getLocationInNewDocument = getLocationInNewDocument;
function applyEdits(text, textFilename, edits) {
for (var _i = 0, edits_2 = edits; _i < edits_2.length; _i++) {
var _a = edits_2[_i], fileName = _a.fileName, textChanges_4 = _a.textChanges;
for (var _i = 0, edits_1 = edits; _i < edits_1.length; _i++) {
var _a = edits_1[_i], fileName = _a.fileName, textChanges_1 = _a.textChanges;
if (fileName !== textFilename) {
continue;
}
for (var i = textChanges_4.length - 1; i >= 0; i--) {
var _b = textChanges_4[i], newText = _b.newText, _c = _b.span, start = _c.start, length_6 = _c.length;
text = text.slice(0, start) + newText + text.slice(start + length_6);
for (var i = textChanges_1.length - 1; i >= 0; i--) {
var _b = textChanges_1[i], newText = _b.newText, _c = _b.span, start = _c.start, length_1 = _c.length;
text = text.slice(0, start) + newText + text.slice(start + length_1);
}
}
return text;

16
lib/typescript.d.ts vendored
View file

@ -422,7 +422,7 @@ declare namespace ts {
FirstJSDocNode = 288,
LastJSDocNode = 310,
FirstJSDocTagNode = 299,
LastJSDocTagNode = 310
LastJSDocTagNode = 310,
}
enum NodeFlags {
None = 0,
@ -451,7 +451,7 @@ declare namespace ts {
ReachabilityCheckFlags = 384,
ReachabilityAndEmitFlags = 1408,
ContextFlags = 12679168,
TypeExcludesFlags = 20480
TypeExcludesFlags = 20480,
}
enum ModifierFlags {
None = 0,
@ -1008,7 +1008,7 @@ declare namespace ts {
Octal = 32,
HexSpecifier = 64,
BinarySpecifier = 128,
OctalSpecifier = 256
OctalSpecifier = 256,
}
interface NumericLiteral extends LiteralExpression {
kind: SyntaxKind.NumericLiteral;
@ -2061,7 +2061,7 @@ declare namespace ts {
WriteTypeParametersOrArguments = 1,
UseOnlyExternalAliasing = 2,
AllowAnyNodeKind = 4,
UseAliasDefinedOutsideCurrentScope = 8
UseAliasDefinedOutsideCurrentScope = 8,
}
enum TypePredicateKind {
This = 0,
@ -2139,7 +2139,7 @@ declare namespace ts {
ExportHasLocal = 944,
BlockScoped = 418,
PropertyOrAccessor = 98308,
ClassMember = 106500
ClassMember = 106500,
}
interface Symbol {
flags: SymbolFlags;
@ -2247,7 +2247,7 @@ declare namespace ts {
Instantiable = 63176704,
StructuredOrInstantiable = 66846720,
Narrowable = 133970943,
NotUnionOrUnit = 67637251
NotUnionOrUnit = 67637251,
}
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
interface Type {
@ -2294,7 +2294,7 @@ declare namespace ts {
MarkerType = 8192,
JSLiteral = 16384,
FreshLiteral = 32768,
ClassOrInterface = 3
ClassOrInterface = 3,
}
interface ObjectType extends Type {
objectFlags: ObjectFlags;
@ -2794,7 +2794,7 @@ declare namespace ts {
NoHoisting = 2097152,
HasEndOfDeclarationMarker = 4194304,
Iterator = 8388608,
NoAsciiEscaping = 16777216
NoAsciiEscaping = 16777216,
}
interface EmitHelper {
readonly name: string;

View file

@ -51051,7 +51051,7 @@ var ts;
if (isTupleType(restType)) {
var associatedNames = restType.target.associatedNames;
var index = pos - paramCount;
return associatedNames ? associatedNames[index] : restParameter.escapedName + "_" + index;
return associatedNames && associatedNames[index] || restParameter.escapedName + "_" + index;
}
return restParameter.escapedName;
}
@ -85619,7 +85619,7 @@ var ts;
* Emits any prologue directives at the start of a Statement list, returning the
* number of prologue directives written to the output.
*/
function emitPrologueDirectives(statements, sourceFile, seenPrologueDirectives) {
function emitPrologueDirectives(statements, sourceFile, seenPrologueDirectives, recordBundleFileSection) {
var needsToSetSourceFile = !!sourceFile;
for (var i = 0; i < statements.length; i++) {
var statement = statements[i];
@ -85633,7 +85633,7 @@ var ts;
writeLine();
var pos = writer.getTextPos();
emit(statement);
if (bundleFileInfo)
if (recordBundleFileSection && bundleFileInfo)
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "prologue" /* Prologue */, data: statement.expression.text });
if (seenPrologueDirectives) {
seenPrologueDirectives.set(statement.expression.text, true);
@ -85674,7 +85674,7 @@ var ts;
}
for (var _c = 0, _d = sourceFileOrBundle.sourceFiles; _c < _d.length; _c++) {
var sourceFile = _d[_c];
emitPrologueDirectives(sourceFile.statements, sourceFile, seenPrologueDirectives);
emitPrologueDirectives(sourceFile.statements, sourceFile, seenPrologueDirectives, /*recordBundleFileSection*/ true);
}
setSourceFile(undefined);
}
@ -94638,8 +94638,8 @@ var ts;
if (baseFileName !== "package.json" && baseFileName !== "bower.json") {
continue;
}
var result_7 = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); });
var packageJson = result_7.config;
var result_1 = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); });
var packageJson = result_1.config;
// npm 3's package.json contains a "_requiredBy" field
// we should include all the top level module names for npm 2, and only module names whose
// "_requiredBy" field starts with "#" or equals "/" for npm 3.
@ -95729,8 +95729,8 @@ var ts;
isWhiteSpaceOnlyJsxText(child);
if (lookInPreviousChild) {
// actual start of the node is past the position - previous token should be at the end of previous child
var candidate_2 = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i, sourceFile);
return candidate_2 && findRightmostToken(candidate_2, sourceFile);
var candidate_1 = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i, sourceFile);
return candidate_1 && findRightmostToken(candidate_1, sourceFile);
}
else {
// candidate should be in this node
@ -96643,14 +96643,14 @@ var ts;
ts.visitEachChild(node, getSynthesizedDeepClone, ts.nullTransformationContext);
if (visited === node) {
// This only happens for leaf nodes - internal nodes always see their children change.
var clone_8 = ts.getSynthesizedClone(node);
if (ts.isStringLiteral(clone_8)) {
clone_8.textSourceNode = node;
var clone_1 = ts.getSynthesizedClone(node);
if (ts.isStringLiteral(clone_1)) {
clone_1.textSourceNode = node;
}
else if (ts.isNumericLiteral(clone_8)) {
clone_8.numericLiteralFlags = node.numericLiteralFlags;
else if (ts.isNumericLiteral(clone_1)) {
clone_1.numericLiteralFlags = node.numericLiteralFlags;
}
return ts.setTextRange(clone_8, node);
return ts.setTextRange(clone_1, node);
}
// PERF: As an optimization, rather than calling getSynthesizedClone, we'll update
// the new node created by visitEachChild with the extra changes getSynthesizedClone
@ -97075,7 +97075,7 @@ var ts;
var lastEnd = 0;
for (var i = 0; i < dense.length; i += 3) {
var start = dense[i];
var length_5 = dense[i + 1];
var length_1 = dense[i + 1];
var type = dense[i + 2];
// Make a whitespace entry between the last item and this one.
if (lastEnd >= 0) {
@ -97084,8 +97084,8 @@ var ts;
entries.push({ length: whitespaceLength_1, classification: ts.TokenClass.Whitespace });
}
}
entries.push({ length: length_5, classification: convertClassification(type) });
lastEnd = start + length_5;
entries.push({ length: length_1, classification: convertClassification(type) });
lastEnd = start + length_1;
}
var whitespaceLength = text.length - lastEnd;
if (whitespaceLength > 0) {
@ -98029,8 +98029,8 @@ var ts;
* both foo.ts and foo.tsx become foo
*/
var foundFiles = ts.createMap(); // maps file to its extension
for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {
var filePath = files_3[_i];
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
var filePath = files_1[_i];
filePath = ts.normalizePath(filePath);
if (exclude && ts.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0 /* EqualTo */) {
continue;
@ -98075,7 +98075,7 @@ var ts;
continue;
var patterns = paths[path];
if (patterns) {
var _loop_11 = function (name, kind, extension) {
var _loop_1 = function (name, kind, extension) {
// Path mappings may provide a duplicate way to get to something we've already added, so don't add again.
if (!result.some(function (entry) { return entry.name === name; })) {
result.push(nameAndKind(name, kind, extension));
@ -98083,7 +98083,7 @@ var ts;
};
for (var _i = 0, _a = getCompletionsForPathMapping(path, patterns, fragment, baseDirectory, fileExtensions, host); _i < _a.length; _i++) {
var _b = _a[_i], name = _b.name, kind = _b.kind, extension = _b.extension;
_loop_11(name, kind, extension);
_loop_1(name, kind, extension);
}
}
}
@ -98118,7 +98118,7 @@ var ts;
// (But do if we didn't find anything, e.g. 'package.json' missing.)
var foundGlobal = false;
if (fragmentDirectory === undefined) {
var _loop_12 = function (moduleName) {
var _loop_2 = function (moduleName) {
if (!result.some(function (entry) { return entry.name === moduleName; })) {
foundGlobal = true;
result.push(nameAndKind(moduleName, "external module name" /* externalModuleName */, /*extension*/ undefined));
@ -98126,7 +98126,7 @@ var ts;
};
for (var _b = 0, _c = enumerateNodeModulesVisibleToScript(host, scriptPath); _b < _c.length; _b++) {
var moduleName = _c[_b];
_loop_12(moduleName);
_loop_2(moduleName);
}
}
if (!foundGlobal) {
@ -98240,8 +98240,8 @@ var ts;
// Check for typings specified in compiler options
var seen = ts.createMap();
var typeRoots = tryAndIgnoreErrors(function () { return ts.getEffectiveTypeRoots(options, host); }) || ts.emptyArray;
for (var _i = 0, typeRoots_2 = typeRoots; _i < typeRoots_2.length; _i++) {
var root = typeRoots_2[_i];
for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) {
var root = typeRoots_1[_i];
getCompletionEntriesFromDirectories(root);
}
// Also get all @types typings installed in visible node_modules directories
@ -98603,8 +98603,8 @@ var ts;
// Based on the order we add things we will always see locals first, then globals, then module exports.
// So adding a completion for a local will prevent us from adding completions for external module exports sharing the same name.
var uniques = ts.createMap();
for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
var symbol = symbols_3[_i];
for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
var symbol = symbols_1[_i];
var origin = symbolToOriginInfoMap ? symbolToOriginInfoMap[ts.getSymbolId(symbol)] : undefined;
var entry = createCompletionEntry(symbol, location, sourceFile, typeChecker, target, kind, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences);
if (!entry) {
@ -98904,9 +98904,9 @@ var ts;
// Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS|
// Skip this partial identifier and adjust the contextToken to the token that precedes it.
if (contextToken && position <= contextToken.end && (ts.isIdentifier(contextToken) || ts.isKeyword(contextToken.kind))) {
var start_3 = ts.timestamp();
var start_1 = ts.timestamp();
contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile, /*startNode*/ undefined); // TODO: GH#18217
log("getCompletionData: Get previous token 2: " + (ts.timestamp() - start_3));
log("getCompletionData: Get previous token 2: " + (ts.timestamp() - start_1));
}
// Find the node where completion is requested on.
// Also determine whether we are trying to complete with members of that node
@ -100998,8 +100998,8 @@ var ts;
function findModuleReferences(program, sourceFiles, searchModuleSymbol) {
var refs = [];
var checker = program.getTypeChecker();
for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) {
var referencingFile = sourceFiles_3[_i];
for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) {
var referencingFile = sourceFiles_1[_i];
var searchSourceFile = searchModuleSymbol.valueDeclaration;
if (searchSourceFile.kind === 284 /* SourceFile */) {
for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) {
@ -101029,8 +101029,8 @@ var ts;
/** Returns a map from a module symbol Id to all import statements that directly reference the module. */
function getDirectImportsMap(sourceFiles, checker, cancellationToken) {
var map = ts.createMap();
for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) {
var sourceFile = sourceFiles_4[_i];
for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) {
var sourceFile = sourceFiles_2[_i];
if (cancellationToken)
cancellationToken.throwIfCancellationRequested();
forEachImport(sourceFile, function (importDecl, moduleSpecifier) {
@ -101342,9 +101342,9 @@ var ts;
// If invoked directly on a shorthand property assignment, then return
// the declaration of the symbol being assigned (not the symbol being assigned to).
if (node.parent.kind === 276 /* ShorthandPropertyAssignment */) {
var result_8 = [];
FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_8.push(nodeEntry(node)); });
return result_8;
var result_1 = [];
FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_1.push(nodeEntry(node)); });
return result_1;
}
else if (node.kind === 98 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) {
// References to and accesses on the super keyword only have one possible implementation, so no
@ -101376,27 +101376,27 @@ var ts;
case 0 /* Symbol */: {
var symbol = def.symbol;
var _a = getDefinitionKindAndDisplayParts(symbol, checker, originalNode), displayParts_1 = _a.displayParts, kind_1 = _a.kind;
var name_4 = displayParts_1.map(function (p) { return p.text; }).join("");
return { node: symbol.declarations ? ts.getNameOfDeclaration(ts.first(symbol.declarations)) || ts.first(symbol.declarations) : originalNode, name: name_4, kind: kind_1, displayParts: displayParts_1 };
var name_1 = displayParts_1.map(function (p) { return p.text; }).join("");
return { node: symbol.declarations ? ts.getNameOfDeclaration(ts.first(symbol.declarations)) || ts.first(symbol.declarations) : originalNode, name: name_1, kind: kind_1, displayParts: displayParts_1 };
}
case 1 /* Label */: {
var node_3 = def.node;
return { node: node_3, name: node_3.text, kind: "label" /* label */, displayParts: [ts.displayPart(node_3.text, ts.SymbolDisplayPartKind.text)] };
var node_1 = def.node;
return { node: node_1, name: node_1.text, kind: "label" /* label */, displayParts: [ts.displayPart(node_1.text, ts.SymbolDisplayPartKind.text)] };
}
case 2 /* Keyword */: {
var node_4 = def.node;
var name_5 = ts.tokenToString(node_4.kind);
return { node: node_4, name: name_5, kind: "keyword" /* keyword */, displayParts: [{ text: name_5, kind: "keyword" /* keyword */ }] };
var node_2 = def.node;
var name_2 = ts.tokenToString(node_2.kind);
return { node: node_2, name: name_2, kind: "keyword" /* keyword */, displayParts: [{ text: name_2, kind: "keyword" /* keyword */ }] };
}
case 3 /* This */: {
var node_5 = def.node;
var symbol = checker.getSymbolAtLocation(node_5);
var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_5.getSourceFile(), ts.getContainerNode(node_5), node_5).displayParts || [ts.textPart("this")];
return { node: node_5, name: "this", kind: "var" /* variableElement */, displayParts: displayParts_2 };
var node_3 = def.node;
var symbol = checker.getSymbolAtLocation(node_3);
var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_3.getSourceFile(), ts.getContainerNode(node_3), node_3).displayParts || [ts.textPart("this")];
return { node: node_3, name: "this", kind: "var" /* variableElement */, displayParts: displayParts_2 };
}
case 4 /* String */: {
var node_6 = def.node;
return { node: node_6, name: node_6.text, kind: "var" /* variableElement */, displayParts: [ts.displayPart(ts.getTextOfNode(node_6), ts.SymbolDisplayPartKind.stringLiteral)] };
var node_4 = def.node;
return { node: node_4, name: node_4.text, kind: "var" /* variableElement */, displayParts: [ts.displayPart(ts.getTextOfNode(node_4), ts.SymbolDisplayPartKind.stringLiteral)] };
}
default:
return ts.Debug.assertNever(def);
@ -101674,7 +101674,7 @@ var ts;
result = references;
continue;
}
var _loop_13 = function (entry) {
var _loop_3 = function (entry) {
if (!entry.definition || entry.definition.type !== 0 /* Symbol */) {
result.push(entry);
return "continue";
@ -101706,7 +101706,7 @@ var ts;
};
for (var _b = 0, references_1 = references; _b < references_1.length; _b++) {
var entry = references_1[_b];
_loop_13(entry);
_loop_3(entry);
}
}
return result;
@ -101966,8 +101966,8 @@ var ts;
var sourceId = ts.getNodeId(sourceFile);
var seenSymbols = this.sourceFileToSeenSymbols[sourceId] || (this.sourceFileToSeenSymbols[sourceId] = ts.createMap());
var anyNewSymbols = false;
for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) {
var sym = symbols_4[_i];
for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
var sym = symbols_2[_i];
anyNewSymbols = ts.addToSeen(seenSymbols, ts.getSymbolId(sym)) || anyNewSymbols;
}
return anyNewSymbols;
@ -102106,8 +102106,8 @@ var ts;
return undefined;
}
var scope;
for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) {
var declaration = declarations_11[_i];
for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) {
var declaration = declarations_1[_i];
var container = ts.getContainerNode(declaration);
if (scope && scope !== container) {
// Different declarations have different containers, bail out
@ -102158,8 +102158,8 @@ var ts;
if (!signature.name || !ts.isIdentifier(signature.name))
return;
var symbol = ts.Debug.assertDefined(checker.getSymbolAtLocation(signature.name));
for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) {
var sourceFile = sourceFiles_5[_i];
for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) {
var sourceFile = sourceFiles_3[_i];
for (var _a = 0, _b = getPossibleSymbolReferenceNodes(sourceFile, symbol.name); _a < _b.length; _a++) {
var name = _b[_a];
if (!ts.isIdentifier(name) || name === signature.name || name.escapedText !== signature.name.escapedText)
@ -102861,8 +102861,8 @@ var ts;
// To achieve that we will keep iterating until the result stabilizes.
// Remember the last meaning
lastIterationMeaning = meaning;
for (var _i = 0, declarations_12 = declarations; _i < declarations_12.length; _i++) {
var declaration = declarations_12[_i];
for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) {
var declaration = declarations_2[_i];
var declarationMeaning = ts.getMeaningFromDeclaration(declaration);
if (declarationMeaning & meaning) {
meaning |= declarationMeaning;
@ -103011,8 +103011,8 @@ var ts;
// Type annotation needed due to #7294
var elements = ts.isArrayLiteralExpression(property.initializer) ? property.initializer.elements : [property.initializer];
var foundExactMatch = false;
for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) {
var element = elements_5[_i];
for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {
var element = elements_1[_i];
foundExactMatch = tryUpdateString(element) || foundExactMatch;
}
return foundExactMatch;
@ -103034,7 +103034,7 @@ var ts;
}
function updateImports(program, changeTracker, oldToNew, newToOld, host, getCanonicalFileName) {
var allFiles = program.getSourceFiles();
var _loop_14 = function (sourceFile) {
var _loop_4 = function (sourceFile) {
var newFromOld = oldToNew(sourceFile.path);
var newImportFromPath = newFromOld !== undefined ? newFromOld : sourceFile.path;
var newImportFromDirectory = ts.getDirectoryPath(newImportFromPath);
@ -103066,7 +103066,7 @@ var ts;
};
for (var _i = 0, allFiles_1 = allFiles; _i < allFiles_1.length; _i++) {
var sourceFile = allFiles_1[_i];
_loop_14(sourceFile);
_loop_4(sourceFile);
}
}
function combineNormal(pathA, pathB) {
@ -103096,9 +103096,9 @@ var ts;
return undefined;
// First try resolved module
if (resolved.resolvedModule) {
var result_9 = tryChange(resolved.resolvedModule.resolvedFileName);
if (result_9)
return result_9;
var result_2 = tryChange(resolved.resolvedModule.resolvedFileName);
if (result_2)
return result_2;
}
// Then failed lookups except package.json since we dont want to touch them (only included ts/js files)
var result = ts.forEach(resolved.failedLookupLocations, tryChangeWithIgnoringPackageJson);
@ -103208,10 +103208,10 @@ var ts;
// bar<Test>(({pr/*goto*/op1})=>{});
if (ts.isPropertyName(node) && ts.isBindingElement(parent) && ts.isObjectBindingPattern(parent.parent) &&
(node === (parent.propertyName || parent.name))) {
var name_6 = ts.getNameFromPropertyName(node);
var name_3 = ts.getNameFromPropertyName(node);
var type = typeChecker.getTypeAtLocation(parent.parent);
return name_6 === undefined ? ts.emptyArray : ts.flatMap(type.isUnion() ? type.types : [type], function (t) {
var prop = t.getProperty(name_6);
return name_3 === undefined ? ts.emptyArray : ts.flatMap(type.isUnion() ? type.types : [type], function (t) {
var prop = t.getProperty(name_3);
return prop && getDefinitionFromSymbol(typeChecker, prop, node);
});
}
@ -103856,7 +103856,7 @@ var ts;
if (!patternMatcher)
return ts.emptyArray;
var rawItems = [];
var _loop_15 = function (sourceFile) {
var _loop_5 = function (sourceFile) {
cancellationToken.throwIfCancellationRequested();
if (excludeDtsFiles && sourceFile.isDeclarationFile) {
return "continue";
@ -103866,9 +103866,9 @@ var ts;
});
};
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) {
var sourceFile = sourceFiles_6[_i];
_loop_15(sourceFile);
for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) {
var sourceFile = sourceFiles_4[_i];
_loop_5(sourceFile);
}
rawItems.sort(compareNavigateToItems);
return (maxResultCount === undefined ? rawItems : rawItems.slice(0, maxResultCount)).map(createNavigateToItem);
@ -103881,8 +103881,8 @@ var ts;
if (!match) {
return; // continue to next named declarations
}
for (var _i = 0, declarations_13 = declarations; _i < declarations_13.length; _i++) {
var declaration = declarations_13[_i];
for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {
var declaration = declarations_3[_i];
if (!shouldKeepItem(declaration, checker))
continue;
if (patternMatcher.patternContainsDots) {
@ -104985,8 +104985,8 @@ var ts;
var lastSingleLineCommentEnd = -1;
var singleLineCommentCount = 0;
var sourceText = sourceFile.getFullText();
for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) {
var _a = comments_2[_i], kind = _a.kind, pos = _a.pos, end = _a.end;
for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) {
var _a = comments_1[_i], kind = _a.kind, pos = _a.pos, end = _a.end;
cancellationToken.throwIfCancellationRequested();
switch (kind) {
case 2 /* SingleLineCommentTrivia */:
@ -105396,15 +105396,15 @@ var ts;
// Assumes 'value' is already lowercase.
function indexOfIgnoringCase(str, value) {
var n = str.length - value.length;
var _loop_16 = function (start) {
var _loop_6 = function (start) {
if (every(value, function (valueChar, i) { return toLowerCase(str.charCodeAt(i + start)) === valueChar; })) {
return { value: start };
}
};
for (var start = 0; start <= n; start++) {
var state_4 = _loop_16(start);
if (typeof state_4 === "object")
return state_4.value;
var state_1 = _loop_6(start);
if (typeof state_1 === "object")
return state_1.value;
}
return -1;
}
@ -106415,7 +106415,7 @@ var ts;
return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
}
function getContainingArgumentInfo(node, position, sourceFile, checker, isManuallyInvoked) {
var _loop_17 = function (n) {
var _loop_7 = function (n) {
// If the node is not a subspan of its parent, this is a big problem.
// There have been crashes that might be caused by this violation.
ts.Debug.assert(ts.rangeContainsRange(n.parent, n), "Not a subspan", function () { return "Child: " + ts.Debug.showSyntaxKind(n) + ", parent: " + ts.Debug.showSyntaxKind(n.parent); });
@ -106425,9 +106425,9 @@ var ts;
}
};
for (var n = node; !ts.isSourceFile(n) && (isManuallyInvoked || !ts.isBlock(n)); n = n.parent) {
var state_5 = _loop_17(n);
if (typeof state_5 === "object")
return state_5.value;
var state_2 = _loop_7(n);
if (typeof state_2 === "object")
return state_2.value;
}
return undefined;
}
@ -106705,8 +106705,8 @@ var ts;
var name = importNameForConvertToDefaultImport(importNode);
if (!name)
continue;
var module_2 = ts.getResolvedModule(sourceFile, moduleSpecifier.text);
var resolvedFile = module_2 && program.getSourceFile(module_2.resolvedFileName);
var module = ts.getResolvedModule(sourceFile, moduleSpecifier.text);
var resolvedFile = module && program.getSourceFile(module.resolvedFileName);
if (resolvedFile && resolvedFile.externalModuleIndicator && ts.isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) {
diags.push(ts.createDiagnosticForNode(name, ts.Diagnostics.Import_may_be_converted_to_a_default_import));
}
@ -106721,8 +106721,8 @@ var ts;
case 196 /* FunctionExpression */:
var decl = ts.getDeclarationOfExpando(node);
if (decl) {
var symbol_2 = decl.symbol;
if (symbol_2 && (symbol_2.exports && symbol_2.exports.size || symbol_2.members && symbol_2.members.size)) {
var symbol_1 = decl.symbol;
if (symbol_1 && (symbol_1.exports && symbol_1.exports.size || symbol_1.members && symbol_1.members.size)) {
diags.push(ts.createDiagnosticForNode(ts.isVariableDeclaration(node.parent) ? node.parent.name : node, ts.Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration));
break;
}
@ -107582,7 +107582,7 @@ var ts;
return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; });
});
options = ts.cloneCompilerOptions(options);
var _loop_18 = function (opt) {
var _loop_8 = function (opt) {
if (!ts.hasProperty(options, opt.name)) {
return "continue";
}
@ -107601,7 +107601,7 @@ var ts;
};
for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {
var opt = commandLineOptionsStringToEnum_1[_i];
_loop_18(opt);
_loop_8(opt);
}
return options;
}
@ -110773,7 +110773,7 @@ var ts;
ChangeTracker.prototype.finishDeleteDeclarations = function () {
var _this = this;
var deletedNodesInLists = new ts.NodeSet(); // Stores nodes in lists that we already deleted. Used to avoid deleting `, ` twice in `a, b`.
var _loop_19 = function (sourceFile, node) {
var _loop_9 = function (sourceFile, node) {
if (!this_1.deletedNodes.some(function (d) { return d.sourceFile === sourceFile && ts.rangeContainsRangeExclusive(d.node, node); })) {
if (ts.isArray(node)) {
this_1.deleteRange(sourceFile, ts.rangeOfTypeParameters(node));
@ -110786,7 +110786,7 @@ var ts;
var this_1 = this;
for (var _i = 0, _a = this.deletedNodes; _i < _a.length; _i++) {
var _b = _a[_i], sourceFile = _b.sourceFile, node = _b.node;
_loop_19(sourceFile, node);
_loop_9(sourceFile, node);
}
deletedNodesInLists.forEach(function (node) {
var sourceFile = node.getSourceFile();
@ -110843,14 +110843,14 @@ var ts;
// order changes by start position
// If the start position is the same, put the shorter range first, since an empty range (x, x) may precede (x, y) but not vice-versa.
var normalized = ts.stableSort(changesInFile, function (a, b) { return (a.range.pos - b.range.pos) || (a.range.end - b.range.end); });
var _loop_20 = function (i) {
var _loop_10 = function (i) {
ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", function () {
return JSON.stringify(normalized[i].range) + " and " + JSON.stringify(normalized[i + 1].range);
});
};
// verify that change intervals do not overlap, except possibly at end points.
for (var i = 0; i < normalized.length - 1; i++) {
_loop_20(i);
_loop_10(i);
}
var textChanges = normalized.map(function (c) {
return ts.createTextChange(ts.createTextSpanFromRange(c.range), computeNewText(c, sourceFile, newLineCharacter, formatContext, validate));
@ -112249,8 +112249,8 @@ var ts;
}
function removeLowPriorityInferences(inferences, priorities) {
var toRemove = [];
for (var _i = 0, inferences_2 = inferences; _i < inferences_2.length; _i++) {
var i = inferences_2[_i];
for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) {
var i = inferences_1[_i];
for (var _a = 0, priorities_1 = priorities; _a < priorities_1.length; _a++) {
var _b = priorities_1[_a], high = _b.high, low = _b.low;
if (high(i)) {
@ -112342,8 +112342,8 @@ var ts;
types.push.apply(types, (usageContext.candidateTypes || []).map(function (t) { return checker.getBaseTypeOfLiteralType(t); }));
if (usageContext.properties && hasCallContext(usageContext.properties.get("then"))) {
var paramType = getParameterTypeFromCallContexts(0, usageContext.properties.get("then").callContexts, /*isRestParameter*/ false, checker); // TODO: GH#18217
var types_20 = paramType.getCallSignatures().map(function (c) { return c.getReturnType(); });
types_20.push(checker.createPromiseType(types_20.length ? checker.getUnionType(types_20, 2 /* Subtype */) : checker.getAnyType()));
var types_1 = paramType.getCallSignatures().map(function (c) { return c.getReturnType(); });
types_1.push(checker.createPromiseType(types_1.length ? checker.getUnionType(types_1, 2 /* Subtype */) : checker.getAnyType()));
}
else if (usageContext.properties && hasCallContext(usageContext.properties.get("push"))) {
types.push(checker.createArrayType(getParameterTypeFromCallContexts(0, usageContext.properties.get("push").callContexts, /*isRestParameter*/ false, checker)));
@ -112352,7 +112352,7 @@ var ts;
types.push(checker.createArrayType(recur(usageContext.numberIndexContext)));
}
else if (usageContext.properties || usageContext.callContexts || usageContext.constructContexts || usageContext.stringIndexContext) {
var members_6 = ts.createUnderscoreEscapedMap();
var members_1 = ts.createUnderscoreEscapedMap();
var callSignatures = [];
var constructSignatures = [];
var stringIndexInfo = void 0;
@ -112360,7 +112360,7 @@ var ts;
usageContext.properties.forEach(function (context, name) {
var symbol = checker.createSymbol(4 /* Property */, name);
symbol.type = recur(context);
members_6.set(name, symbol);
members_1.set(name, symbol);
});
}
if (usageContext.callContexts) {
@ -112378,7 +112378,7 @@ var ts;
if (usageContext.stringIndexContext) {
stringIndexInfo = checker.createIndexInfo(recur(usageContext.stringIndexContext), /*isReadonly*/ false);
}
types.push(checker.createAnonymousType(/*symbol*/ undefined, members_6, callSignatures, constructSignatures, stringIndexInfo, /*numberIndexInfo*/ undefined)); // TODO: GH#18217
types.push(checker.createAnonymousType(/*symbol*/ undefined, members_1, callSignatures, constructSignatures, stringIndexInfo, /*numberIndexInfo*/ undefined)); // TODO: GH#18217
}
return types;
function recur(innerContext) {
@ -112647,7 +112647,7 @@ var ts;
var newNodes = transformExpression(node, transformer, node);
changes.replaceNodeWithNodes(sourceFile, nodeToReplace, newNodes);
}
var _loop_21 = function (statement) {
var _loop_11 = function (statement) {
ts.forEachChild(statement, function visit(node) {
if (ts.isCallExpression(node)) {
startTransformation(node, statement);
@ -112659,7 +112659,7 @@ var ts;
};
for (var _i = 0, returnStatements_1 = returnStatements; _i < returnStatements_1.length; _i++) {
var statement = returnStatements_1[_i];
_loop_21(statement);
_loop_11(statement);
}
}
function getReturnStatementsWithPromiseHandlers(body) {
@ -112984,8 +112984,8 @@ var ts;
if (innerCbBody.length > 0) {
return innerCbBody;
}
var type_6 = transformer.checker.getTypeAtLocation(func);
var returnType_1 = getLastCallSignature(type_6, transformer.checker).getReturnType();
var type_1 = transformer.checker.getTypeAtLocation(func);
var returnType_1 = getLastCallSignature(type_1, transformer.checker).getReturnType();
var rightHandSide = ts.getSynthesizedDeepClone(funcBody);
var possiblyAwaitedRightHandSide = !!transformer.checker.getPromisedTypeOfPromise(returnType_1) ? ts.createAwait(rightHandSide) : rightHandSide;
if (!shouldReturn) {
@ -114311,7 +114311,7 @@ var ts;
});
typeDeclToMembers.forEach(function (infos, classDeclaration) {
var supers = getAllSupers(classDeclaration, checker);
var _loop_22 = function (info) {
var _loop_12 = function (info) {
// If some superclass added this property, don't add it again.
if (supers.some(function (superClassOrInterface) {
var superInfos = typeDeclToMembers.get(superClassOrInterface);
@ -114338,7 +114338,7 @@ var ts;
};
for (var _i = 0, infos_1 = infos; _i < infos_1.length; _i++) {
var info = infos_1[_i];
_loop_22(info);
_loop_12(info);
}
});
}));
@ -115573,8 +115573,8 @@ var ts;
outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences));
break;
}
for (var _i = 0, signatures_7 = signatures; _i < signatures_7.length; _i++) {
var signature = signatures_7[_i];
for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) {
var signature = signatures_1[_i];
// Need to ensure nodes are fresh each time so they can have different positions.
outputMethod(signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false));
}
@ -115657,8 +115657,8 @@ var ts;
var maxArgsSignature = signatures[0];
var minArgumentCount = signatures[0].minArgumentCount;
var someSigHasRestParameter = false;
for (var _i = 0, signatures_8 = signatures; _i < signatures_8.length; _i++) {
var sig = signatures_8[_i];
for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) {
var sig = signatures_2[_i];
minArgumentCount = Math.min(sig.minArgumentCount, minArgumentCount);
if (sig.hasRestParameter) {
someSigHasRestParameter = true;
@ -115817,8 +115817,8 @@ var ts;
ts.addRange(fixes, getCodeFixesForImportDeclaration(context, relatedImport));
}
if (ts.isExpression(expr) && !(ts.isNamedDeclaration(expr.parent) && expr.parent.name === expr)) {
var sourceFile_3 = context.sourceFile;
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile_3, expr, ts.createPropertyAccess(expr, "default"), {}); });
var sourceFile_1 = context.sourceFile;
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile_1, expr, ts.createPropertyAccess(expr, "default"), {}); });
fixes.push(codefix.createCodeFixActionNoFixId(fixName, changes, ts.Diagnostics.Use_synthetic_default_member));
}
return fixes;
@ -116098,9 +116098,9 @@ var ts;
forEachOwnNodeOfFunction(fnAst, function (node) {
if (ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) &&
ts.isPropertyAccessExpression(node.left) && node.left.expression.kind === 100 /* ThisKeyword */) {
var name_7 = node.left.name.text;
if (!ts.isJsPrivate(name_7)) {
ts.getOrUpdate(members, name_7, function () { return ts.createProperty(/*decorators*/ undefined, /*modifiers*/ undefined, name_7, /*questionOrExclamationToken*/ undefined, anyType(), /*initializer*/ undefined); });
var name_4 = node.left.name.text;
if (!ts.isJsPrivate(name_4)) {
ts.getOrUpdate(members, name_4, function () { return ts.createProperty(/*decorators*/ undefined, /*modifiers*/ undefined, name_4, /*questionOrExclamationToken*/ undefined, anyType(), /*initializer*/ undefined); });
}
}
});
@ -116615,7 +116615,7 @@ var ts;
});
var namespaceImportName = namespaceNameConflicts ? ts.getUniqueName(preferredName, sourceFile) : preferredName;
var neededNamedImports = [];
var _loop_23 = function (element) {
var _loop_13 = function (element) {
var propertyName = (element.propertyName || element.name).text;
ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
var access = ts.createPropertyAccess(ts.createIdentifier(namespaceImportName), propertyName);
@ -116634,7 +116634,7 @@ var ts;
};
for (var _i = 0, _a = toConvert.elements; _i < _a.length; _i++) {
var element = _a[_i];
_loop_23(element);
_loop_13(element);
}
changes.replaceNode(sourceFile, toConvert, ts.createNamespaceImport(ts.createIdentifier(namespaceImportName)));
if (neededNamedImports.length) {
@ -117689,8 +117689,8 @@ var ts;
ts.Debug.assert(members.length > 0); // There must be at least one child, since we extracted from one.
var prevMember;
var allProperties = true;
for (var _i = 0, members_7 = members; _i < members_7.length; _i++) {
var member = members_7[_i];
for (var _i = 0, members_2 = members; _i < members_2.length; _i++) {
var member = members_2[_i];
if (member.pos > maxPos) {
return prevMember || members[0];
}
@ -117864,7 +117864,7 @@ var ts;
: ts.getEnclosingBlockScopeContainer(scopes[0]);
ts.forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations);
}
var _loop_24 = function (i) {
var _loop_14 = function (i) {
var scopeUsages = usagesPerScope[i];
// Special case: in the innermost scope, all usages are available.
// (The computed value reflects the value at the top-level of the scope, but the
@ -117904,7 +117904,7 @@ var ts;
}
};
for (var i = 0; i < scopes.length; i++) {
_loop_24(i);
_loop_14(i);
}
return { target: target, usagesPerScope: usagesPerScope, functionErrorsPerScope: functionErrorsPerScope, constantErrorsPerScope: constantErrorsPerScope, exposedVariableDeclarations: exposedVariableDeclarations };
function isInGenericContext(node) {
@ -118455,10 +118455,10 @@ var ts;
}
function updateImportsInOtherFiles(changes, program, oldFile, movedSymbols, newModuleName) {
var checker = program.getTypeChecker();
var _loop_25 = function (sourceFile) {
var _loop_15 = function (sourceFile) {
if (sourceFile === oldFile)
return "continue";
var _loop_26 = function (statement) {
var _loop_16 = function (statement) {
forEachImportInStatement(statement, function (importNode) {
if (checker.getSymbolAtLocation(moduleSpecifierFromImport(importNode)) !== oldFile.symbol)
return;
@ -118480,12 +118480,12 @@ var ts;
};
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var statement = _a[_i];
_loop_26(statement);
_loop_16(statement);
}
};
for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
var sourceFile = _a[_i];
_loop_25(sourceFile);
_loop_15(sourceFile);
}
}
function getNamespaceLikeImport(node) {
@ -118600,9 +118600,9 @@ var ts;
if (isTopLevelDeclarationStatement(statement) &&
!isExported(sourceFile, statement, useEs6Exports) &&
forEachTopLevelDeclaration(statement, function (d) { return needExport.has(ts.Debug.assertDefined(d.symbol)); })) {
var exports_2 = addExport(statement, useEs6Exports);
if (exports_2)
return exports_2;
var exports = addExport(statement, useEs6Exports);
if (exports)
return exports;
}
return statement;
});
@ -119275,8 +119275,8 @@ var ts;
var list = createNode(311 /* SyntaxList */, nodes.pos, nodes.end, parent);
list._children = [];
var pos = nodes.pos;
for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) {
var node = nodes_7[_i];
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
var node = nodes_1[_i];
addSyntheticNodes(list._children, pos, node.pos, parent);
list._children.push(node);
pos = node.end;
@ -119520,8 +119520,8 @@ var ts;
return ts.emptyArray;
var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations);
if (doc.length === 0 || declarations.some(hasJSDocInheritDocTag)) {
for (var _i = 0, declarations_14 = declarations; _i < declarations_14.length; _i++) {
var declaration = declarations_14[_i];
for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
var declaration = declarations_4[_i];
var inheritedDocs = findInheritedJSDocComments(declaration, declaration.symbol.name, checker); // TODO: GH#18217
// TODO: GH#16312 Return a ReadonlyArray, avoid copying inheritedDocs
if (inheritedDocs)
@ -120273,14 +120273,14 @@ var ts;
var typeChecker = program.getTypeChecker();
var symbol = getSymbolAtLocationForQuickInfo(node, typeChecker);
if (!symbol || typeChecker.isUnknownSymbol(symbol)) {
var type_7 = shouldGetType(sourceFile, node, position) ? typeChecker.getTypeAtLocation(node) : undefined;
return type_7 && {
var type_2 = shouldGetType(sourceFile, node, position) ? typeChecker.getTypeAtLocation(node) : undefined;
return type_2 && {
kind: "" /* unknown */,
kindModifiers: "" /* none */,
textSpan: ts.createTextSpanFromNode(node, sourceFile),
displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_7, ts.getContainerNode(node)); }),
documentation: type_7.symbol ? type_7.symbol.getDocumentationComment(typeChecker) : undefined,
tags: type_7.symbol ? type_7.symbol.getJsDocTags() : undefined
displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_2, ts.getContainerNode(node)); }),
documentation: type_2.symbol ? type_2.symbol.getDocumentationComment(typeChecker) : undefined,
tags: type_2.symbol ? type_2.symbol.getJsDocTags() : undefined
};
}
var _a = typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) {

View file

@ -422,7 +422,7 @@ declare namespace ts {
FirstJSDocNode = 288,
LastJSDocNode = 310,
FirstJSDocTagNode = 299,
LastJSDocTagNode = 310
LastJSDocTagNode = 310,
}
enum NodeFlags {
None = 0,
@ -451,7 +451,7 @@ declare namespace ts {
ReachabilityCheckFlags = 384,
ReachabilityAndEmitFlags = 1408,
ContextFlags = 12679168,
TypeExcludesFlags = 20480
TypeExcludesFlags = 20480,
}
enum ModifierFlags {
None = 0,
@ -1008,7 +1008,7 @@ declare namespace ts {
Octal = 32,
HexSpecifier = 64,
BinarySpecifier = 128,
OctalSpecifier = 256
OctalSpecifier = 256,
}
interface NumericLiteral extends LiteralExpression {
kind: SyntaxKind.NumericLiteral;
@ -2061,7 +2061,7 @@ declare namespace ts {
WriteTypeParametersOrArguments = 1,
UseOnlyExternalAliasing = 2,
AllowAnyNodeKind = 4,
UseAliasDefinedOutsideCurrentScope = 8
UseAliasDefinedOutsideCurrentScope = 8,
}
enum TypePredicateKind {
This = 0,
@ -2139,7 +2139,7 @@ declare namespace ts {
ExportHasLocal = 944,
BlockScoped = 418,
PropertyOrAccessor = 98308,
ClassMember = 106500
ClassMember = 106500,
}
interface Symbol {
flags: SymbolFlags;
@ -2247,7 +2247,7 @@ declare namespace ts {
Instantiable = 63176704,
StructuredOrInstantiable = 66846720,
Narrowable = 133970943,
NotUnionOrUnit = 67637251
NotUnionOrUnit = 67637251,
}
type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression;
interface Type {
@ -2294,7 +2294,7 @@ declare namespace ts {
MarkerType = 8192,
JSLiteral = 16384,
FreshLiteral = 32768,
ClassOrInterface = 3
ClassOrInterface = 3,
}
interface ObjectType extends Type {
objectFlags: ObjectFlags;
@ -2794,7 +2794,7 @@ declare namespace ts {
NoHoisting = 2097152,
HasEndOfDeclarationMarker = 4194304,
Iterator = 8388608,
NoAsciiEscaping = 16777216
NoAsciiEscaping = 16777216,
}
interface EmitHelper {
readonly name: string;

View file

@ -51051,7 +51051,7 @@ var ts;
if (isTupleType(restType)) {
var associatedNames = restType.target.associatedNames;
var index = pos - paramCount;
return associatedNames ? associatedNames[index] : restParameter.escapedName + "_" + index;
return associatedNames && associatedNames[index] || restParameter.escapedName + "_" + index;
}
return restParameter.escapedName;
}
@ -85619,7 +85619,7 @@ var ts;
* Emits any prologue directives at the start of a Statement list, returning the
* number of prologue directives written to the output.
*/
function emitPrologueDirectives(statements, sourceFile, seenPrologueDirectives) {
function emitPrologueDirectives(statements, sourceFile, seenPrologueDirectives, recordBundleFileSection) {
var needsToSetSourceFile = !!sourceFile;
for (var i = 0; i < statements.length; i++) {
var statement = statements[i];
@ -85633,7 +85633,7 @@ var ts;
writeLine();
var pos = writer.getTextPos();
emit(statement);
if (bundleFileInfo)
if (recordBundleFileSection && bundleFileInfo)
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "prologue" /* Prologue */, data: statement.expression.text });
if (seenPrologueDirectives) {
seenPrologueDirectives.set(statement.expression.text, true);
@ -85674,7 +85674,7 @@ var ts;
}
for (var _c = 0, _d = sourceFileOrBundle.sourceFiles; _c < _d.length; _c++) {
var sourceFile = _d[_c];
emitPrologueDirectives(sourceFile.statements, sourceFile, seenPrologueDirectives);
emitPrologueDirectives(sourceFile.statements, sourceFile, seenPrologueDirectives, /*recordBundleFileSection*/ true);
}
setSourceFile(undefined);
}
@ -94638,8 +94638,8 @@ var ts;
if (baseFileName !== "package.json" && baseFileName !== "bower.json") {
continue;
}
var result_7 = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); });
var packageJson = result_7.config;
var result_1 = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); });
var packageJson = result_1.config;
// npm 3's package.json contains a "_requiredBy" field
// we should include all the top level module names for npm 2, and only module names whose
// "_requiredBy" field starts with "#" or equals "/" for npm 3.
@ -95729,8 +95729,8 @@ var ts;
isWhiteSpaceOnlyJsxText(child);
if (lookInPreviousChild) {
// actual start of the node is past the position - previous token should be at the end of previous child
var candidate_2 = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i, sourceFile);
return candidate_2 && findRightmostToken(candidate_2, sourceFile);
var candidate_1 = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i, sourceFile);
return candidate_1 && findRightmostToken(candidate_1, sourceFile);
}
else {
// candidate should be in this node
@ -96643,14 +96643,14 @@ var ts;
ts.visitEachChild(node, getSynthesizedDeepClone, ts.nullTransformationContext);
if (visited === node) {
// This only happens for leaf nodes - internal nodes always see their children change.
var clone_8 = ts.getSynthesizedClone(node);
if (ts.isStringLiteral(clone_8)) {
clone_8.textSourceNode = node;
var clone_1 = ts.getSynthesizedClone(node);
if (ts.isStringLiteral(clone_1)) {
clone_1.textSourceNode = node;
}
else if (ts.isNumericLiteral(clone_8)) {
clone_8.numericLiteralFlags = node.numericLiteralFlags;
else if (ts.isNumericLiteral(clone_1)) {
clone_1.numericLiteralFlags = node.numericLiteralFlags;
}
return ts.setTextRange(clone_8, node);
return ts.setTextRange(clone_1, node);
}
// PERF: As an optimization, rather than calling getSynthesizedClone, we'll update
// the new node created by visitEachChild with the extra changes getSynthesizedClone
@ -97075,7 +97075,7 @@ var ts;
var lastEnd = 0;
for (var i = 0; i < dense.length; i += 3) {
var start = dense[i];
var length_5 = dense[i + 1];
var length_1 = dense[i + 1];
var type = dense[i + 2];
// Make a whitespace entry between the last item and this one.
if (lastEnd >= 0) {
@ -97084,8 +97084,8 @@ var ts;
entries.push({ length: whitespaceLength_1, classification: ts.TokenClass.Whitespace });
}
}
entries.push({ length: length_5, classification: convertClassification(type) });
lastEnd = start + length_5;
entries.push({ length: length_1, classification: convertClassification(type) });
lastEnd = start + length_1;
}
var whitespaceLength = text.length - lastEnd;
if (whitespaceLength > 0) {
@ -98029,8 +98029,8 @@ var ts;
* both foo.ts and foo.tsx become foo
*/
var foundFiles = ts.createMap(); // maps file to its extension
for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {
var filePath = files_3[_i];
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
var filePath = files_1[_i];
filePath = ts.normalizePath(filePath);
if (exclude && ts.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0 /* EqualTo */) {
continue;
@ -98075,7 +98075,7 @@ var ts;
continue;
var patterns = paths[path];
if (patterns) {
var _loop_11 = function (name, kind, extension) {
var _loop_1 = function (name, kind, extension) {
// Path mappings may provide a duplicate way to get to something we've already added, so don't add again.
if (!result.some(function (entry) { return entry.name === name; })) {
result.push(nameAndKind(name, kind, extension));
@ -98083,7 +98083,7 @@ var ts;
};
for (var _i = 0, _a = getCompletionsForPathMapping(path, patterns, fragment, baseDirectory, fileExtensions, host); _i < _a.length; _i++) {
var _b = _a[_i], name = _b.name, kind = _b.kind, extension = _b.extension;
_loop_11(name, kind, extension);
_loop_1(name, kind, extension);
}
}
}
@ -98118,7 +98118,7 @@ var ts;
// (But do if we didn't find anything, e.g. 'package.json' missing.)
var foundGlobal = false;
if (fragmentDirectory === undefined) {
var _loop_12 = function (moduleName) {
var _loop_2 = function (moduleName) {
if (!result.some(function (entry) { return entry.name === moduleName; })) {
foundGlobal = true;
result.push(nameAndKind(moduleName, "external module name" /* externalModuleName */, /*extension*/ undefined));
@ -98126,7 +98126,7 @@ var ts;
};
for (var _b = 0, _c = enumerateNodeModulesVisibleToScript(host, scriptPath); _b < _c.length; _b++) {
var moduleName = _c[_b];
_loop_12(moduleName);
_loop_2(moduleName);
}
}
if (!foundGlobal) {
@ -98240,8 +98240,8 @@ var ts;
// Check for typings specified in compiler options
var seen = ts.createMap();
var typeRoots = tryAndIgnoreErrors(function () { return ts.getEffectiveTypeRoots(options, host); }) || ts.emptyArray;
for (var _i = 0, typeRoots_2 = typeRoots; _i < typeRoots_2.length; _i++) {
var root = typeRoots_2[_i];
for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) {
var root = typeRoots_1[_i];
getCompletionEntriesFromDirectories(root);
}
// Also get all @types typings installed in visible node_modules directories
@ -98603,8 +98603,8 @@ var ts;
// Based on the order we add things we will always see locals first, then globals, then module exports.
// So adding a completion for a local will prevent us from adding completions for external module exports sharing the same name.
var uniques = ts.createMap();
for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
var symbol = symbols_3[_i];
for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
var symbol = symbols_1[_i];
var origin = symbolToOriginInfoMap ? symbolToOriginInfoMap[ts.getSymbolId(symbol)] : undefined;
var entry = createCompletionEntry(symbol, location, sourceFile, typeChecker, target, kind, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences);
if (!entry) {
@ -98904,9 +98904,9 @@ var ts;
// Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS|
// Skip this partial identifier and adjust the contextToken to the token that precedes it.
if (contextToken && position <= contextToken.end && (ts.isIdentifier(contextToken) || ts.isKeyword(contextToken.kind))) {
var start_3 = ts.timestamp();
var start_1 = ts.timestamp();
contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile, /*startNode*/ undefined); // TODO: GH#18217
log("getCompletionData: Get previous token 2: " + (ts.timestamp() - start_3));
log("getCompletionData: Get previous token 2: " + (ts.timestamp() - start_1));
}
// Find the node where completion is requested on.
// Also determine whether we are trying to complete with members of that node
@ -100998,8 +100998,8 @@ var ts;
function findModuleReferences(program, sourceFiles, searchModuleSymbol) {
var refs = [];
var checker = program.getTypeChecker();
for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) {
var referencingFile = sourceFiles_3[_i];
for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) {
var referencingFile = sourceFiles_1[_i];
var searchSourceFile = searchModuleSymbol.valueDeclaration;
if (searchSourceFile.kind === 284 /* SourceFile */) {
for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) {
@ -101029,8 +101029,8 @@ var ts;
/** Returns a map from a module symbol Id to all import statements that directly reference the module. */
function getDirectImportsMap(sourceFiles, checker, cancellationToken) {
var map = ts.createMap();
for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) {
var sourceFile = sourceFiles_4[_i];
for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) {
var sourceFile = sourceFiles_2[_i];
if (cancellationToken)
cancellationToken.throwIfCancellationRequested();
forEachImport(sourceFile, function (importDecl, moduleSpecifier) {
@ -101342,9 +101342,9 @@ var ts;
// If invoked directly on a shorthand property assignment, then return
// the declaration of the symbol being assigned (not the symbol being assigned to).
if (node.parent.kind === 276 /* ShorthandPropertyAssignment */) {
var result_8 = [];
FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_8.push(nodeEntry(node)); });
return result_8;
var result_1 = [];
FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_1.push(nodeEntry(node)); });
return result_1;
}
else if (node.kind === 98 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) {
// References to and accesses on the super keyword only have one possible implementation, so no
@ -101376,27 +101376,27 @@ var ts;
case 0 /* Symbol */: {
var symbol = def.symbol;
var _a = getDefinitionKindAndDisplayParts(symbol, checker, originalNode), displayParts_1 = _a.displayParts, kind_1 = _a.kind;
var name_4 = displayParts_1.map(function (p) { return p.text; }).join("");
return { node: symbol.declarations ? ts.getNameOfDeclaration(ts.first(symbol.declarations)) || ts.first(symbol.declarations) : originalNode, name: name_4, kind: kind_1, displayParts: displayParts_1 };
var name_1 = displayParts_1.map(function (p) { return p.text; }).join("");
return { node: symbol.declarations ? ts.getNameOfDeclaration(ts.first(symbol.declarations)) || ts.first(symbol.declarations) : originalNode, name: name_1, kind: kind_1, displayParts: displayParts_1 };
}
case 1 /* Label */: {
var node_3 = def.node;
return { node: node_3, name: node_3.text, kind: "label" /* label */, displayParts: [ts.displayPart(node_3.text, ts.SymbolDisplayPartKind.text)] };
var node_1 = def.node;
return { node: node_1, name: node_1.text, kind: "label" /* label */, displayParts: [ts.displayPart(node_1.text, ts.SymbolDisplayPartKind.text)] };
}
case 2 /* Keyword */: {
var node_4 = def.node;
var name_5 = ts.tokenToString(node_4.kind);
return { node: node_4, name: name_5, kind: "keyword" /* keyword */, displayParts: [{ text: name_5, kind: "keyword" /* keyword */ }] };
var node_2 = def.node;
var name_2 = ts.tokenToString(node_2.kind);
return { node: node_2, name: name_2, kind: "keyword" /* keyword */, displayParts: [{ text: name_2, kind: "keyword" /* keyword */ }] };
}
case 3 /* This */: {
var node_5 = def.node;
var symbol = checker.getSymbolAtLocation(node_5);
var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_5.getSourceFile(), ts.getContainerNode(node_5), node_5).displayParts || [ts.textPart("this")];
return { node: node_5, name: "this", kind: "var" /* variableElement */, displayParts: displayParts_2 };
var node_3 = def.node;
var symbol = checker.getSymbolAtLocation(node_3);
var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_3.getSourceFile(), ts.getContainerNode(node_3), node_3).displayParts || [ts.textPart("this")];
return { node: node_3, name: "this", kind: "var" /* variableElement */, displayParts: displayParts_2 };
}
case 4 /* String */: {
var node_6 = def.node;
return { node: node_6, name: node_6.text, kind: "var" /* variableElement */, displayParts: [ts.displayPart(ts.getTextOfNode(node_6), ts.SymbolDisplayPartKind.stringLiteral)] };
var node_4 = def.node;
return { node: node_4, name: node_4.text, kind: "var" /* variableElement */, displayParts: [ts.displayPart(ts.getTextOfNode(node_4), ts.SymbolDisplayPartKind.stringLiteral)] };
}
default:
return ts.Debug.assertNever(def);
@ -101674,7 +101674,7 @@ var ts;
result = references;
continue;
}
var _loop_13 = function (entry) {
var _loop_3 = function (entry) {
if (!entry.definition || entry.definition.type !== 0 /* Symbol */) {
result.push(entry);
return "continue";
@ -101706,7 +101706,7 @@ var ts;
};
for (var _b = 0, references_1 = references; _b < references_1.length; _b++) {
var entry = references_1[_b];
_loop_13(entry);
_loop_3(entry);
}
}
return result;
@ -101966,8 +101966,8 @@ var ts;
var sourceId = ts.getNodeId(sourceFile);
var seenSymbols = this.sourceFileToSeenSymbols[sourceId] || (this.sourceFileToSeenSymbols[sourceId] = ts.createMap());
var anyNewSymbols = false;
for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) {
var sym = symbols_4[_i];
for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
var sym = symbols_2[_i];
anyNewSymbols = ts.addToSeen(seenSymbols, ts.getSymbolId(sym)) || anyNewSymbols;
}
return anyNewSymbols;
@ -102106,8 +102106,8 @@ var ts;
return undefined;
}
var scope;
for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) {
var declaration = declarations_11[_i];
for (var _i = 0, declarations_1 = declarations; _i < declarations_1.length; _i++) {
var declaration = declarations_1[_i];
var container = ts.getContainerNode(declaration);
if (scope && scope !== container) {
// Different declarations have different containers, bail out
@ -102158,8 +102158,8 @@ var ts;
if (!signature.name || !ts.isIdentifier(signature.name))
return;
var symbol = ts.Debug.assertDefined(checker.getSymbolAtLocation(signature.name));
for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) {
var sourceFile = sourceFiles_5[_i];
for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) {
var sourceFile = sourceFiles_3[_i];
for (var _a = 0, _b = getPossibleSymbolReferenceNodes(sourceFile, symbol.name); _a < _b.length; _a++) {
var name = _b[_a];
if (!ts.isIdentifier(name) || name === signature.name || name.escapedText !== signature.name.escapedText)
@ -102861,8 +102861,8 @@ var ts;
// To achieve that we will keep iterating until the result stabilizes.
// Remember the last meaning
lastIterationMeaning = meaning;
for (var _i = 0, declarations_12 = declarations; _i < declarations_12.length; _i++) {
var declaration = declarations_12[_i];
for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) {
var declaration = declarations_2[_i];
var declarationMeaning = ts.getMeaningFromDeclaration(declaration);
if (declarationMeaning & meaning) {
meaning |= declarationMeaning;
@ -103011,8 +103011,8 @@ var ts;
// Type annotation needed due to #7294
var elements = ts.isArrayLiteralExpression(property.initializer) ? property.initializer.elements : [property.initializer];
var foundExactMatch = false;
for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) {
var element = elements_5[_i];
for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {
var element = elements_1[_i];
foundExactMatch = tryUpdateString(element) || foundExactMatch;
}
return foundExactMatch;
@ -103034,7 +103034,7 @@ var ts;
}
function updateImports(program, changeTracker, oldToNew, newToOld, host, getCanonicalFileName) {
var allFiles = program.getSourceFiles();
var _loop_14 = function (sourceFile) {
var _loop_4 = function (sourceFile) {
var newFromOld = oldToNew(sourceFile.path);
var newImportFromPath = newFromOld !== undefined ? newFromOld : sourceFile.path;
var newImportFromDirectory = ts.getDirectoryPath(newImportFromPath);
@ -103066,7 +103066,7 @@ var ts;
};
for (var _i = 0, allFiles_1 = allFiles; _i < allFiles_1.length; _i++) {
var sourceFile = allFiles_1[_i];
_loop_14(sourceFile);
_loop_4(sourceFile);
}
}
function combineNormal(pathA, pathB) {
@ -103096,9 +103096,9 @@ var ts;
return undefined;
// First try resolved module
if (resolved.resolvedModule) {
var result_9 = tryChange(resolved.resolvedModule.resolvedFileName);
if (result_9)
return result_9;
var result_2 = tryChange(resolved.resolvedModule.resolvedFileName);
if (result_2)
return result_2;
}
// Then failed lookups except package.json since we dont want to touch them (only included ts/js files)
var result = ts.forEach(resolved.failedLookupLocations, tryChangeWithIgnoringPackageJson);
@ -103208,10 +103208,10 @@ var ts;
// bar<Test>(({pr/*goto*/op1})=>{});
if (ts.isPropertyName(node) && ts.isBindingElement(parent) && ts.isObjectBindingPattern(parent.parent) &&
(node === (parent.propertyName || parent.name))) {
var name_6 = ts.getNameFromPropertyName(node);
var name_3 = ts.getNameFromPropertyName(node);
var type = typeChecker.getTypeAtLocation(parent.parent);
return name_6 === undefined ? ts.emptyArray : ts.flatMap(type.isUnion() ? type.types : [type], function (t) {
var prop = t.getProperty(name_6);
return name_3 === undefined ? ts.emptyArray : ts.flatMap(type.isUnion() ? type.types : [type], function (t) {
var prop = t.getProperty(name_3);
return prop && getDefinitionFromSymbol(typeChecker, prop, node);
});
}
@ -103856,7 +103856,7 @@ var ts;
if (!patternMatcher)
return ts.emptyArray;
var rawItems = [];
var _loop_15 = function (sourceFile) {
var _loop_5 = function (sourceFile) {
cancellationToken.throwIfCancellationRequested();
if (excludeDtsFiles && sourceFile.isDeclarationFile) {
return "continue";
@ -103866,9 +103866,9 @@ var ts;
});
};
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) {
var sourceFile = sourceFiles_6[_i];
_loop_15(sourceFile);
for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) {
var sourceFile = sourceFiles_4[_i];
_loop_5(sourceFile);
}
rawItems.sort(compareNavigateToItems);
return (maxResultCount === undefined ? rawItems : rawItems.slice(0, maxResultCount)).map(createNavigateToItem);
@ -103881,8 +103881,8 @@ var ts;
if (!match) {
return; // continue to next named declarations
}
for (var _i = 0, declarations_13 = declarations; _i < declarations_13.length; _i++) {
var declaration = declarations_13[_i];
for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {
var declaration = declarations_3[_i];
if (!shouldKeepItem(declaration, checker))
continue;
if (patternMatcher.patternContainsDots) {
@ -104985,8 +104985,8 @@ var ts;
var lastSingleLineCommentEnd = -1;
var singleLineCommentCount = 0;
var sourceText = sourceFile.getFullText();
for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) {
var _a = comments_2[_i], kind = _a.kind, pos = _a.pos, end = _a.end;
for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) {
var _a = comments_1[_i], kind = _a.kind, pos = _a.pos, end = _a.end;
cancellationToken.throwIfCancellationRequested();
switch (kind) {
case 2 /* SingleLineCommentTrivia */:
@ -105396,15 +105396,15 @@ var ts;
// Assumes 'value' is already lowercase.
function indexOfIgnoringCase(str, value) {
var n = str.length - value.length;
var _loop_16 = function (start) {
var _loop_6 = function (start) {
if (every(value, function (valueChar, i) { return toLowerCase(str.charCodeAt(i + start)) === valueChar; })) {
return { value: start };
}
};
for (var start = 0; start <= n; start++) {
var state_4 = _loop_16(start);
if (typeof state_4 === "object")
return state_4.value;
var state_1 = _loop_6(start);
if (typeof state_1 === "object")
return state_1.value;
}
return -1;
}
@ -106415,7 +106415,7 @@ var ts;
return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart);
}
function getContainingArgumentInfo(node, position, sourceFile, checker, isManuallyInvoked) {
var _loop_17 = function (n) {
var _loop_7 = function (n) {
// If the node is not a subspan of its parent, this is a big problem.
// There have been crashes that might be caused by this violation.
ts.Debug.assert(ts.rangeContainsRange(n.parent, n), "Not a subspan", function () { return "Child: " + ts.Debug.showSyntaxKind(n) + ", parent: " + ts.Debug.showSyntaxKind(n.parent); });
@ -106425,9 +106425,9 @@ var ts;
}
};
for (var n = node; !ts.isSourceFile(n) && (isManuallyInvoked || !ts.isBlock(n)); n = n.parent) {
var state_5 = _loop_17(n);
if (typeof state_5 === "object")
return state_5.value;
var state_2 = _loop_7(n);
if (typeof state_2 === "object")
return state_2.value;
}
return undefined;
}
@ -106705,8 +106705,8 @@ var ts;
var name = importNameForConvertToDefaultImport(importNode);
if (!name)
continue;
var module_2 = ts.getResolvedModule(sourceFile, moduleSpecifier.text);
var resolvedFile = module_2 && program.getSourceFile(module_2.resolvedFileName);
var module = ts.getResolvedModule(sourceFile, moduleSpecifier.text);
var resolvedFile = module && program.getSourceFile(module.resolvedFileName);
if (resolvedFile && resolvedFile.externalModuleIndicator && ts.isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) {
diags.push(ts.createDiagnosticForNode(name, ts.Diagnostics.Import_may_be_converted_to_a_default_import));
}
@ -106721,8 +106721,8 @@ var ts;
case 196 /* FunctionExpression */:
var decl = ts.getDeclarationOfExpando(node);
if (decl) {
var symbol_2 = decl.symbol;
if (symbol_2 && (symbol_2.exports && symbol_2.exports.size || symbol_2.members && symbol_2.members.size)) {
var symbol_1 = decl.symbol;
if (symbol_1 && (symbol_1.exports && symbol_1.exports.size || symbol_1.members && symbol_1.members.size)) {
diags.push(ts.createDiagnosticForNode(ts.isVariableDeclaration(node.parent) ? node.parent.name : node, ts.Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration));
break;
}
@ -107582,7 +107582,7 @@ var ts;
return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; });
});
options = ts.cloneCompilerOptions(options);
var _loop_18 = function (opt) {
var _loop_8 = function (opt) {
if (!ts.hasProperty(options, opt.name)) {
return "continue";
}
@ -107601,7 +107601,7 @@ var ts;
};
for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {
var opt = commandLineOptionsStringToEnum_1[_i];
_loop_18(opt);
_loop_8(opt);
}
return options;
}
@ -110773,7 +110773,7 @@ var ts;
ChangeTracker.prototype.finishDeleteDeclarations = function () {
var _this = this;
var deletedNodesInLists = new ts.NodeSet(); // Stores nodes in lists that we already deleted. Used to avoid deleting `, ` twice in `a, b`.
var _loop_19 = function (sourceFile, node) {
var _loop_9 = function (sourceFile, node) {
if (!this_1.deletedNodes.some(function (d) { return d.sourceFile === sourceFile && ts.rangeContainsRangeExclusive(d.node, node); })) {
if (ts.isArray(node)) {
this_1.deleteRange(sourceFile, ts.rangeOfTypeParameters(node));
@ -110786,7 +110786,7 @@ var ts;
var this_1 = this;
for (var _i = 0, _a = this.deletedNodes; _i < _a.length; _i++) {
var _b = _a[_i], sourceFile = _b.sourceFile, node = _b.node;
_loop_19(sourceFile, node);
_loop_9(sourceFile, node);
}
deletedNodesInLists.forEach(function (node) {
var sourceFile = node.getSourceFile();
@ -110843,14 +110843,14 @@ var ts;
// order changes by start position
// If the start position is the same, put the shorter range first, since an empty range (x, x) may precede (x, y) but not vice-versa.
var normalized = ts.stableSort(changesInFile, function (a, b) { return (a.range.pos - b.range.pos) || (a.range.end - b.range.end); });
var _loop_20 = function (i) {
var _loop_10 = function (i) {
ts.Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", function () {
return JSON.stringify(normalized[i].range) + " and " + JSON.stringify(normalized[i + 1].range);
});
};
// verify that change intervals do not overlap, except possibly at end points.
for (var i = 0; i < normalized.length - 1; i++) {
_loop_20(i);
_loop_10(i);
}
var textChanges = normalized.map(function (c) {
return ts.createTextChange(ts.createTextSpanFromRange(c.range), computeNewText(c, sourceFile, newLineCharacter, formatContext, validate));
@ -112249,8 +112249,8 @@ var ts;
}
function removeLowPriorityInferences(inferences, priorities) {
var toRemove = [];
for (var _i = 0, inferences_2 = inferences; _i < inferences_2.length; _i++) {
var i = inferences_2[_i];
for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) {
var i = inferences_1[_i];
for (var _a = 0, priorities_1 = priorities; _a < priorities_1.length; _a++) {
var _b = priorities_1[_a], high = _b.high, low = _b.low;
if (high(i)) {
@ -112342,8 +112342,8 @@ var ts;
types.push.apply(types, (usageContext.candidateTypes || []).map(function (t) { return checker.getBaseTypeOfLiteralType(t); }));
if (usageContext.properties && hasCallContext(usageContext.properties.get("then"))) {
var paramType = getParameterTypeFromCallContexts(0, usageContext.properties.get("then").callContexts, /*isRestParameter*/ false, checker); // TODO: GH#18217
var types_20 = paramType.getCallSignatures().map(function (c) { return c.getReturnType(); });
types_20.push(checker.createPromiseType(types_20.length ? checker.getUnionType(types_20, 2 /* Subtype */) : checker.getAnyType()));
var types_1 = paramType.getCallSignatures().map(function (c) { return c.getReturnType(); });
types_1.push(checker.createPromiseType(types_1.length ? checker.getUnionType(types_1, 2 /* Subtype */) : checker.getAnyType()));
}
else if (usageContext.properties && hasCallContext(usageContext.properties.get("push"))) {
types.push(checker.createArrayType(getParameterTypeFromCallContexts(0, usageContext.properties.get("push").callContexts, /*isRestParameter*/ false, checker)));
@ -112352,7 +112352,7 @@ var ts;
types.push(checker.createArrayType(recur(usageContext.numberIndexContext)));
}
else if (usageContext.properties || usageContext.callContexts || usageContext.constructContexts || usageContext.stringIndexContext) {
var members_6 = ts.createUnderscoreEscapedMap();
var members_1 = ts.createUnderscoreEscapedMap();
var callSignatures = [];
var constructSignatures = [];
var stringIndexInfo = void 0;
@ -112360,7 +112360,7 @@ var ts;
usageContext.properties.forEach(function (context, name) {
var symbol = checker.createSymbol(4 /* Property */, name);
symbol.type = recur(context);
members_6.set(name, symbol);
members_1.set(name, symbol);
});
}
if (usageContext.callContexts) {
@ -112378,7 +112378,7 @@ var ts;
if (usageContext.stringIndexContext) {
stringIndexInfo = checker.createIndexInfo(recur(usageContext.stringIndexContext), /*isReadonly*/ false);
}
types.push(checker.createAnonymousType(/*symbol*/ undefined, members_6, callSignatures, constructSignatures, stringIndexInfo, /*numberIndexInfo*/ undefined)); // TODO: GH#18217
types.push(checker.createAnonymousType(/*symbol*/ undefined, members_1, callSignatures, constructSignatures, stringIndexInfo, /*numberIndexInfo*/ undefined)); // TODO: GH#18217
}
return types;
function recur(innerContext) {
@ -112647,7 +112647,7 @@ var ts;
var newNodes = transformExpression(node, transformer, node);
changes.replaceNodeWithNodes(sourceFile, nodeToReplace, newNodes);
}
var _loop_21 = function (statement) {
var _loop_11 = function (statement) {
ts.forEachChild(statement, function visit(node) {
if (ts.isCallExpression(node)) {
startTransformation(node, statement);
@ -112659,7 +112659,7 @@ var ts;
};
for (var _i = 0, returnStatements_1 = returnStatements; _i < returnStatements_1.length; _i++) {
var statement = returnStatements_1[_i];
_loop_21(statement);
_loop_11(statement);
}
}
function getReturnStatementsWithPromiseHandlers(body) {
@ -112984,8 +112984,8 @@ var ts;
if (innerCbBody.length > 0) {
return innerCbBody;
}
var type_6 = transformer.checker.getTypeAtLocation(func);
var returnType_1 = getLastCallSignature(type_6, transformer.checker).getReturnType();
var type_1 = transformer.checker.getTypeAtLocation(func);
var returnType_1 = getLastCallSignature(type_1, transformer.checker).getReturnType();
var rightHandSide = ts.getSynthesizedDeepClone(funcBody);
var possiblyAwaitedRightHandSide = !!transformer.checker.getPromisedTypeOfPromise(returnType_1) ? ts.createAwait(rightHandSide) : rightHandSide;
if (!shouldReturn) {
@ -114311,7 +114311,7 @@ var ts;
});
typeDeclToMembers.forEach(function (infos, classDeclaration) {
var supers = getAllSupers(classDeclaration, checker);
var _loop_22 = function (info) {
var _loop_12 = function (info) {
// If some superclass added this property, don't add it again.
if (supers.some(function (superClassOrInterface) {
var superInfos = typeDeclToMembers.get(superClassOrInterface);
@ -114338,7 +114338,7 @@ var ts;
};
for (var _i = 0, infos_1 = infos; _i < infos_1.length; _i++) {
var info = infos_1[_i];
_loop_22(info);
_loop_12(info);
}
});
}));
@ -115573,8 +115573,8 @@ var ts;
outputMethod(signature, modifiers, name, createStubbedMethodBody(preferences));
break;
}
for (var _i = 0, signatures_7 = signatures; _i < signatures_7.length; _i++) {
var signature = signatures_7[_i];
for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) {
var signature = signatures_1[_i];
// Need to ensure nodes are fresh each time so they can have different positions.
outputMethod(signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false));
}
@ -115657,8 +115657,8 @@ var ts;
var maxArgsSignature = signatures[0];
var minArgumentCount = signatures[0].minArgumentCount;
var someSigHasRestParameter = false;
for (var _i = 0, signatures_8 = signatures; _i < signatures_8.length; _i++) {
var sig = signatures_8[_i];
for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) {
var sig = signatures_2[_i];
minArgumentCount = Math.min(sig.minArgumentCount, minArgumentCount);
if (sig.hasRestParameter) {
someSigHasRestParameter = true;
@ -115817,8 +115817,8 @@ var ts;
ts.addRange(fixes, getCodeFixesForImportDeclaration(context, relatedImport));
}
if (ts.isExpression(expr) && !(ts.isNamedDeclaration(expr.parent) && expr.parent.name === expr)) {
var sourceFile_3 = context.sourceFile;
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile_3, expr, ts.createPropertyAccess(expr, "default"), {}); });
var sourceFile_1 = context.sourceFile;
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return t.replaceNode(sourceFile_1, expr, ts.createPropertyAccess(expr, "default"), {}); });
fixes.push(codefix.createCodeFixActionNoFixId(fixName, changes, ts.Diagnostics.Use_synthetic_default_member));
}
return fixes;
@ -116098,9 +116098,9 @@ var ts;
forEachOwnNodeOfFunction(fnAst, function (node) {
if (ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) &&
ts.isPropertyAccessExpression(node.left) && node.left.expression.kind === 100 /* ThisKeyword */) {
var name_7 = node.left.name.text;
if (!ts.isJsPrivate(name_7)) {
ts.getOrUpdate(members, name_7, function () { return ts.createProperty(/*decorators*/ undefined, /*modifiers*/ undefined, name_7, /*questionOrExclamationToken*/ undefined, anyType(), /*initializer*/ undefined); });
var name_4 = node.left.name.text;
if (!ts.isJsPrivate(name_4)) {
ts.getOrUpdate(members, name_4, function () { return ts.createProperty(/*decorators*/ undefined, /*modifiers*/ undefined, name_4, /*questionOrExclamationToken*/ undefined, anyType(), /*initializer*/ undefined); });
}
}
});
@ -116615,7 +116615,7 @@ var ts;
});
var namespaceImportName = namespaceNameConflicts ? ts.getUniqueName(preferredName, sourceFile) : preferredName;
var neededNamedImports = [];
var _loop_23 = function (element) {
var _loop_13 = function (element) {
var propertyName = (element.propertyName || element.name).text;
ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
var access = ts.createPropertyAccess(ts.createIdentifier(namespaceImportName), propertyName);
@ -116634,7 +116634,7 @@ var ts;
};
for (var _i = 0, _a = toConvert.elements; _i < _a.length; _i++) {
var element = _a[_i];
_loop_23(element);
_loop_13(element);
}
changes.replaceNode(sourceFile, toConvert, ts.createNamespaceImport(ts.createIdentifier(namespaceImportName)));
if (neededNamedImports.length) {
@ -117689,8 +117689,8 @@ var ts;
ts.Debug.assert(members.length > 0); // There must be at least one child, since we extracted from one.
var prevMember;
var allProperties = true;
for (var _i = 0, members_7 = members; _i < members_7.length; _i++) {
var member = members_7[_i];
for (var _i = 0, members_2 = members; _i < members_2.length; _i++) {
var member = members_2[_i];
if (member.pos > maxPos) {
return prevMember || members[0];
}
@ -117864,7 +117864,7 @@ var ts;
: ts.getEnclosingBlockScopeContainer(scopes[0]);
ts.forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations);
}
var _loop_24 = function (i) {
var _loop_14 = function (i) {
var scopeUsages = usagesPerScope[i];
// Special case: in the innermost scope, all usages are available.
// (The computed value reflects the value at the top-level of the scope, but the
@ -117904,7 +117904,7 @@ var ts;
}
};
for (var i = 0; i < scopes.length; i++) {
_loop_24(i);
_loop_14(i);
}
return { target: target, usagesPerScope: usagesPerScope, functionErrorsPerScope: functionErrorsPerScope, constantErrorsPerScope: constantErrorsPerScope, exposedVariableDeclarations: exposedVariableDeclarations };
function isInGenericContext(node) {
@ -118455,10 +118455,10 @@ var ts;
}
function updateImportsInOtherFiles(changes, program, oldFile, movedSymbols, newModuleName) {
var checker = program.getTypeChecker();
var _loop_25 = function (sourceFile) {
var _loop_15 = function (sourceFile) {
if (sourceFile === oldFile)
return "continue";
var _loop_26 = function (statement) {
var _loop_16 = function (statement) {
forEachImportInStatement(statement, function (importNode) {
if (checker.getSymbolAtLocation(moduleSpecifierFromImport(importNode)) !== oldFile.symbol)
return;
@ -118480,12 +118480,12 @@ var ts;
};
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var statement = _a[_i];
_loop_26(statement);
_loop_16(statement);
}
};
for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
var sourceFile = _a[_i];
_loop_25(sourceFile);
_loop_15(sourceFile);
}
}
function getNamespaceLikeImport(node) {
@ -118600,9 +118600,9 @@ var ts;
if (isTopLevelDeclarationStatement(statement) &&
!isExported(sourceFile, statement, useEs6Exports) &&
forEachTopLevelDeclaration(statement, function (d) { return needExport.has(ts.Debug.assertDefined(d.symbol)); })) {
var exports_2 = addExport(statement, useEs6Exports);
if (exports_2)
return exports_2;
var exports = addExport(statement, useEs6Exports);
if (exports)
return exports;
}
return statement;
});
@ -119275,8 +119275,8 @@ var ts;
var list = createNode(311 /* SyntaxList */, nodes.pos, nodes.end, parent);
list._children = [];
var pos = nodes.pos;
for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) {
var node = nodes_7[_i];
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
var node = nodes_1[_i];
addSyntheticNodes(list._children, pos, node.pos, parent);
list._children.push(node);
pos = node.end;
@ -119520,8 +119520,8 @@ var ts;
return ts.emptyArray;
var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations);
if (doc.length === 0 || declarations.some(hasJSDocInheritDocTag)) {
for (var _i = 0, declarations_14 = declarations; _i < declarations_14.length; _i++) {
var declaration = declarations_14[_i];
for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) {
var declaration = declarations_4[_i];
var inheritedDocs = findInheritedJSDocComments(declaration, declaration.symbol.name, checker); // TODO: GH#18217
// TODO: GH#16312 Return a ReadonlyArray, avoid copying inheritedDocs
if (inheritedDocs)
@ -120273,14 +120273,14 @@ var ts;
var typeChecker = program.getTypeChecker();
var symbol = getSymbolAtLocationForQuickInfo(node, typeChecker);
if (!symbol || typeChecker.isUnknownSymbol(symbol)) {
var type_7 = shouldGetType(sourceFile, node, position) ? typeChecker.getTypeAtLocation(node) : undefined;
return type_7 && {
var type_2 = shouldGetType(sourceFile, node, position) ? typeChecker.getTypeAtLocation(node) : undefined;
return type_2 && {
kind: "" /* unknown */,
kindModifiers: "" /* none */,
textSpan: ts.createTextSpanFromNode(node, sourceFile),
displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_7, ts.getContainerNode(node)); }),
documentation: type_7.symbol ? type_7.symbol.getDocumentationComment(typeChecker) : undefined,
tags: type_7.symbol ? type_7.symbol.getJsDocTags() : undefined
displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_2, ts.getContainerNode(node)); }),
documentation: type_2.symbol ? type_2.symbol.getDocumentationComment(typeChecker) : undefined,
tags: type_2.symbol ? type_2.symbol.getJsDocTags() : undefined
};
}
var _a = typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) {

View file

@ -14,31 +14,6 @@ and limitations under the License.
***************************************************************************** */
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
@ -82,6 +57,19 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var ts;
(function (ts) {
// WARNING: The script `configureNightly.ts` uses a regexp to parse out these values.
@ -51064,7 +51052,7 @@ var ts;
if (isTupleType(restType)) {
var associatedNames = restType.target.associatedNames;
var index = pos - paramCount;
return associatedNames ? associatedNames[index] : restParameter.escapedName + "_" + index;
return associatedNames && associatedNames[index] || restParameter.escapedName + "_" + index;
}
return restParameter.escapedName;
}
@ -85632,7 +85620,7 @@ var ts;
* Emits any prologue directives at the start of a Statement list, returning the
* number of prologue directives written to the output.
*/
function emitPrologueDirectives(statements, sourceFile, seenPrologueDirectives) {
function emitPrologueDirectives(statements, sourceFile, seenPrologueDirectives, recordBundleFileSection) {
var needsToSetSourceFile = !!sourceFile;
for (var i = 0; i < statements.length; i++) {
var statement = statements[i];
@ -85646,7 +85634,7 @@ var ts;
writeLine();
var pos = writer.getTextPos();
emit(statement);
if (bundleFileInfo)
if (recordBundleFileSection && bundleFileInfo)
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "prologue" /* Prologue */, data: statement.expression.text });
if (seenPrologueDirectives) {
seenPrologueDirectives.set(statement.expression.text, true);
@ -85687,7 +85675,7 @@ var ts;
}
for (var _c = 0, _d = sourceFileOrBundle.sourceFiles; _c < _d.length; _c++) {
var sourceFile = _d[_c];
emitPrologueDirectives(sourceFile.statements, sourceFile, seenPrologueDirectives);
emitPrologueDirectives(sourceFile.statements, sourceFile, seenPrologueDirectives, /*recordBundleFileSection*/ true);
}
setSourceFile(undefined);
}
@ -94402,8 +94390,6 @@ var ts;
}
}
})(ts || (ts = {}));
//# sourceMappingURL=compiler.js.map
"use strict";
/* @internal */
var ts;
(function (ts) {
@ -94744,8 +94730,6 @@ var ts;
JsTyping.renderPackageNameValidationFailure = renderPackageNameValidationFailure;
})(JsTyping = ts.JsTyping || (ts.JsTyping = {}));
})(ts || (ts = {}));
//# sourceMappingURL=jsTyping.js.map
"use strict";
var ts;
(function (ts) {
var server;
@ -95222,7 +95206,6 @@ var ts;
})(typingsInstaller = server.typingsInstaller || (server.typingsInstaller = {}));
})(server = ts.server || (ts.server = {}));
})(ts || (ts = {}));
//# sourceMappingURL=typingsInstallerCore.js.map
var ts;
(function (ts) {
var server;